我有在 Spring Boot 中将 List 转换为 Page 的业务逻辑。在该代码中,我的可分页排序不会在输出中排序。如果我可以通过 pageable 排序或从 pageable.getSort() 排序列表,有没有办法?注意:我正在使用 new PageImpl() 将列表转换为页面。*int start = (int) pageable.getOffset(); int end = (start + pageable.getPageSize()) > List.size() ?List.size() : (start + pageable.getPageSize()); Page paginatedList = new PageImpl(floorsheetList.subList(start, end), pageable, list.size());我实际上得到 sorted= true 但数据不会排序。sort: {sorted: true,unsorted: false,empty: false}更新Turns out PageImpl cannot sort the data. So have to manually sort it via Collections or any other APIs.
添加回答
举报
0/150
提交
取消