We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
springBoot1.5.9+mybatis+oracle+pagehelper5.0
public ServiceResponse queryPageByParams(String groupName,String userName, int currentPage, int pageSize) throws Exception{ PageHelper.startPage(currentPage, pageSize);//如1,5 List<CheckGroupVo> checkGroupVoList = checkGroupUserDao.queryPageByParams(groupName,userName);//查出来的结果是13条 if(checkGroupVoList == null){ return ServiceResponse.createByResponseCode(ResponseCode.NOT_EXIST); } PageInfo info = new PageInfo(checkGroupVoList); System.out.println(info.getList());//经过上面PageInfo后,pageSize居然等于总记录数13!!! return ServiceResponse.createByResponseCodeData(ResponseCode.GET_SUCCESS, new PageInfo(checkGroupVoList)); }
然后调试进入new PageInfo时,居然进入下面的 else if (list instanceof Collection)条件,把查询出来的总记录数赋值给每页显示数量 this.pageSize = list.size();!!!! 什么情况?
public PageInfo(List<T> list, int navigatePages) { super(list); if (list instanceof Page) { Page page = (Page) list; this.pageNum = page.getPageNum(); this.pageSize = page.getPageSize(); this.pages = page.getPages(); this.size = page.size(); //由于结果是>startRow的,所以实际的需要+1 if (this.size == 0) { this.startRow = 0; this.endRow = 0; } else { this.startRow = page.getStartRow() + 1; //计算实际的endRow(最后一页的时候特殊) this.endRow = this.startRow - 1 + this.size; } }else if (list instanceof Collection) { this.pageNum = 1; this.pageSize = list.size(); this.pages = this.pageSize > 0 ? 1 : 0; this.size = list.size(); this.startRow = 0; this.endRow = list.size() > 0 ? list.size() - 1 : 0; } if (list instanceof Collection) { this.navigatePages = navigatePages; //计算导航页 calcNavigatepageNums(); //计算前后页,第一页,最后一页 calcPage(); //判断页面边界 judgePageBoudary(); } }
The text was updated successfully, but these errors were encountered:
说明你的代码没有真正进行分页,你可以看 SQL 日志。
最有可能的情况就是分页插件没配置对,没起作用。
Sorry, something went wrong.
No branches or pull requests
springBoot1.5.9+mybatis+oracle+pagehelper5.0
下面这个是我的方法:
然后调试进入new PageInfo时,居然进入下面的 else if (list instanceof Collection)条件,把查询出来的总记录数赋值给每页显示数量 this.pageSize = list.size();!!!!
什么情况?
The text was updated successfully, but these errors were encountered: