1. mapper 层返回的 List 的泛型和 service 层返回的PageInfo 的泛型类型一致:

@Override
public PageInfo<VO1> queryVO1List(String startTime,String endTime,Integer pageNum,Integer pageSize) {
    boolean pageStarted = false;
    try {
        PageHelper.startPage( pageNum,pageSize );
        pageStarted = true;
        List<VO1> vo1List = this.xxxMapper.queryVO1List( startTime,endTime );
        if( vo1List == null || vo1List.size() == 0 ){
            return new PageInfo<VO1>(new ArrayList<>(0));
        }
        return new PageInfo<VO1>( vo1List );
    } catch (Exception e) {
        log.error(Constants.EXCEPTION_LOG_PREFIX,e);
        return new PageInfo<VO1>(new ArrayList<>(0));
    }finally {
        if( pageStarted ){
            PageHelper.clearPage();
        }
    }
}

2. mapper 层返回的 List 的泛型和 service 层返回的 PageInfo 的泛型类型不一致:

@Override
public PageInfo<VO2> queryVO2List(String startTime,String endTime,Integer pageNum,Integer pageSize) {
    boolean pageStarted = false;
    try {
        PageHelper.startPage( pageNum,pageSize );
        pageStarted = true;
        List<VO1> vo1List = this.xxxMapper.queryVO1List( startTime,endTime );
        if( vo1List == null || vo1List.size() == 0 ){
            return new PageInfo<VO2>(new ArrayList<>(0));
        }
        PageInfo<VO1> pageInfo_vo1 = new PageInfo<>(vo1List);
        List<VO2> vo2List = this.vo1ListToVO2List( vo1List );
        PageInfo<VO2> pageInfo_vo2 = new PageInfo<>();
        pageInfo_vo1.setList( null );
        BeanUtils.copyProperties( pageInfo_vo1,pageInfo_vo2 );
        pageInfo_vo2.setList( vo2List );
        return pageInfo_vo2;
    } catch (Exception e) {
        log.error(Constants.EXCEPTION_LOG_PREFIX,e);
        return new PageInfo<VO2>(new ArrayList<>(0));
    }finally {
        if( pageStarted ){
            PageHelper.clearPage();
        }
    }
}
01-02 09:57