我有在 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
提交
取消