-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
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
数据查询返回后进行转化,hasNextPage属性值永远是false #810
Comments
是转化过后,所有属性都要手动赋值吗? |
大概率是你转换方法丢失了分页信息,可以考虑用下面的方法: /**
* 数据对象转换
*
* @param function 用以转换数据对象的函数
* @param <E> 目标类型
* @return 转换了对象类型的包装结果
*/
public <E> PageInfo<E> convert(Page.Function<T, E> function) {
List<E> list = new ArrayList<E>(this.list.size());
for (T t : this.list) {
list.add(function.apply(t));
}
PageInfo<E> newPageInfo = new PageInfo<>(list);
newPageInfo.setPageNum(this.pageNum);
newPageInfo.setPageSize(this.pageSize);
newPageInfo.setSize(this.size);
newPageInfo.setStartRow(this.startRow);
newPageInfo.setEndRow(this.endRow);
newPageInfo.setTotal(this.total);
newPageInfo.setPages(this.pages);
newPageInfo.setPrePage(this.prePage);
newPageInfo.setNextPage(this.nextPage);
newPageInfo.setIsFirstPage(this.isFirstPage);
newPageInfo.setIsLastPage(this.isLastPage);
newPageInfo.setHasPreviousPage(this.hasPreviousPage);
newPageInfo.setHasNextPage(this.hasNextPage);
newPageInfo.setNavigatePages(this.navigatePages);
newPageInfo.setNavigateFirstPage(this.navigateFirstPage);
newPageInfo.setNavigateLastPage(this.navigateLastPage);
newPageInfo.setNavigatepageNums(this.navigatepageNums);
return newPageInfo;
}
|
我换了种使用方式就行了: PageInfo page=new PageInfo(dbList);
page.setList(convertedList); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
异常模板
使用环境
SQL 解析错误
分页参数
原 SQL
期望的结果:
完整异常信息
hasNextPage属性值异常
异常信息放在这里
The text was updated successfully, but these errors were encountered: