selectWithAttrs 使用流分页

This commit is contained in:
wangliwen 2022-06-28 09:16:40 +08:00
parent 99bb41556d
commit 5176f58ac8
1 changed files with 8 additions and 10 deletions

View File

@ -255,10 +255,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resultPage.setRecords(null);
resultPage.setTotal(0);
} else {
ArrayList<ResourceDTO> recordLists = new ArrayList<>();
for (int i = (pageNum - 1) * pageSize; i < j; i++) {
recordLists.add(resourceDTOS.get(i));
}
List<ResourceDTO> recordLists = resourceDTOS.stream()
.skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
resultPage.setRecords(recordLists);
resultPage.setTotal(resourceDTOS.size());
}