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

@ -143,10 +143,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
break; break;
} }
}); });
if (params.containsKey("selectType") && "1" .equals(params.get("selectType").toString())) { // 创建者查询时 if (params.containsKey("selectType") && "1".equals(params.get("selectType").toString())) { // 创建者查询时
wrapper.ne("del_flag", 1); wrapper.ne("del_flag", 1);
} else if (params.containsKey("selectType") && "0" .equals(params.get("selectType").toString())) { } else if (params.containsKey("selectType") && "0".equals(params.get("selectType").toString())) {
if (params.containsKey("delFlag") && !"" .equals(params.get("delFlag").toString())) { if (params.containsKey("delFlag") && !"".equals(params.get("delFlag").toString())) {
wrapper.eq("del_flag", params.get("delFlag")); wrapper.eq("del_flag", params.get("delFlag"));
} else { } else {
wrapper.in(true, "del_flag", 0, 5); wrapper.in(true, "del_flag", 0, 5);
@ -255,10 +255,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resultPage.setRecords(null); resultPage.setRecords(null);
resultPage.setTotal(0); resultPage.setTotal(0);
} else { } else {
ArrayList<ResourceDTO> recordLists = new ArrayList<>(); List<ResourceDTO> recordLists = resourceDTOS.stream()
for (int i = (pageNum - 1) * pageSize; i < j; i++) { .skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
recordLists.add(resourceDTOS.get(i));
}
resultPage.setRecords(recordLists); resultPage.setRecords(recordLists);
resultPage.setTotal(resourceDTOS.size()); resultPage.setTotal(resourceDTOS.size());
} }
@ -266,7 +264,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
break; break;
case TSINGTAO_XHA: { case TSINGTAO_XHA: {
if ("基础设施" .equals(resourceDTO.getType())) { // 基础设施 if ("基础设施".equals(resourceDTO.getType())) { // 基础设施
logger.info("西海岸基础设施"); logger.info("西海岸基础设施");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
OkHttpClient client = new OkHttpClient(); OkHttpClient client = new OkHttpClient();
@ -551,7 +549,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream().collect(Collectors.groupingBy(m -> m.get("type").toString())); Map<String, List<Map<String, Object>>> 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<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("type", item.getKey()); map.put("type", item.getKey());
Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type")); Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type"));
@ -882,7 +880,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
AttrEntity attrEntity = new AttrEntity(); AttrEntity attrEntity = new AttrEntity();
attrEntity.setDelFlag(0); attrEntity.setDelFlag(0);
attrEntity.setAttrType("文件类型"); attrEntity.setAttrType("文件类型");
if ("f49561afc7204f008c4bb3cd821eb6ba" .equals(index)) { if ("f49561afc7204f008c4bb3cd821eb6ba".equals(index)) {
attrEntity.setAttrValue("政府公报"); attrEntity.setAttrValue("政府公报");
} else { } else {
attrEntity.setAttrValue("政策解读"); attrEntity.setAttrValue("政策解读");