From 5176f58ac86a11b0db190b6ede4656849c7e734a Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 28 Jun 2022 09:16:40 +0800 Subject: [PATCH] =?UTF-8?q?selectWithAttrs=20=E4=BD=BF=E7=94=A8=E6=B5=81?= =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResourceServiceImpl.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 77be0171..538472c4 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -143,10 +143,10 @@ public class ResourceServiceImpl extends CrudServiceImpl recordLists = new ArrayList<>(); - for (int i = (pageNum - 1) * pageSize; i < j; i++) { - recordLists.add(resourceDTOS.get(i)); - } + List recordLists = resourceDTOS.stream() + .skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); resultPage.setRecords(recordLists); resultPage.setTotal(resourceDTOS.size()); } @@ -266,7 +264,7 @@ public class ResourceServiceImpl extends CrudServiceImpl>> listMap = typeMapList.stream().collect(Collectors.groupingBy(m -> m.get("type").toString())); //区级要根据行政区划多加一层结构 - listMap.entrySet().stream().filter(index -> !"区级" .equals(index.getKey())).forEach(item -> { + listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).forEach(item -> { HashMap map = new HashMap<>(); map.put("type", item.getKey()); Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type")); @@ -882,7 +880,7 @@ public class ResourceServiceImpl extends CrudServiceImpl