今天在调用一个查询列表的接口时,分页总数老是查的不正确:
当pageSize选择10时,总数只有10条
当pageSize选择20时,总数只有15条
实际上总数为15条实在正确的,然后取看代码:
@Override public AjaxResult projectCountDetail(Long id, StorageAccount account, String firstCategory, String secondCategory, String toolName, String modelName, Integer pageNum, Integer pageSize) { PageHelper.startPage(pageNum, pageSize); Listlist = this.storageProjectInfoManagementMapper.projectCountDetail(id, account.getAccount(), firstCategory, secondCategory, toolName, modelName); for (ProjectStatisticsVo projectStatisticsVo : list) { //判断工器具是否有标识 Integer flag = storageRecipientRecordMapper.getToolFlag(projectStatisticsVo.getId()); //无标识false projectStatisticsVo.setFlag(flag == 1 ? false : true); //归还数量 int backCount = storageProjectInfoManagementMapper.getBackCount(id, projectStatisticsVo.getId(), account.getAccount()); projectStatisticsVo.setReturnCount(backCount); projectStatisticsVo.setNoReturnCount(projectStatisticsVo.getRecipientCount() - projectStatisticsVo.getReturnCount()); projectStatisticsVo.setProjectId(id); } List list = list.stream() .filter(projectStatisticsVo -> projectStatisticsVo.getId() != null) .collect(Collectors.toList()); PageInfo pageInfo = new PageInfo<>(list); return AjaxResult.success(pageInfo); }
问题排查:
PageInfo后面取得时二次操作的list,导致分页失败
解决:
简单改成这样就OK
猜你喜欢
网友评论
- 搜索
- 最新文章
- 热门文章