1.1.PageHelper先开启分页,后对list数据操作
1.问题
1.1.PageHelper先开启分页,后对list数据操作
@Override
public PageInfo<HdQueryVo> getRecordsByView(int pageNo, int pageSize) {
PageHelper.startPage(pageNo,pageSize);
List<HdQueryVo> hdQueryVosByView = actionMapper.getActionByView();
List<HdQueryVo> hdQueryVos = new ArrayList<>();
for (HdQueryVo hdQueryVo : hdQueryVosByView) {
HdQueryVo hdQueryVoSingle = new HdQueryVo();
hdQueryVoSingle.setHdId(hdQueryVo.getHdId());
hdQueryVoSingle.setHdType(hdQueryVo.getHdType());
hdQueryVoSingle.setHdTitle(hdQueryVo.getHdTitle());
hdQueryVoSingle.setHdStartDate(hdQueryVo.getHdStartDate());
hdQueryVoSingle.setHdEndDate(hdQueryVo.getHdEndDate());
hdQueryVoSingle.setHdStatus(hdQueryVo.getHdStatus());
hdQueryVoSingle.setHdImage(hdQueryVo.getHdImage());
hdQueryVoSingle.setHdNumber(hdQueryVo.getHdNumber());
hdQueryVoSingle.setGmtCreate(hdQueryVo.getGmtCreate());
hdQueryVoSingle.setGmtModified(hdQueryVo.getGmtModified());
hdQueryVoSingle.setUserId(hdQueryVo.getUserId());
if (hdQueryVo.getHdType().equals(0)) {
hdQueryVoSingle.setHdJoinUsers(onlineWorksMapper.getOnlineJoinUsers(hdQueryVo.getHdId()));
} else {
hdQueryVoSingle.setHdJoinUsers(offlineUsersMapper.getOfflineJoinUsers(hdQueryVo.getHdId()));
}
hdQueryVos.add(hdQueryVoSingle);
}
PageInfo<HdQueryVo> pageViewInfo = new PageInfo<>(hdQueryVos);
return pageViewInfo;
}
可以分页,但是数据量错误,total始终等于每页数据量,即pageSize