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;
}
});
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);
} else if (params.containsKey("selectType") && "0" .equals(params.get("selectType").toString())) {
if (params.containsKey("delFlag") && !"" .equals(params.get("delFlag").toString())) {
} else if (params.containsKey("selectType") && "0".equals(params.get("selectType").toString())) {
if (params.containsKey("delFlag") && !"".equals(params.get("delFlag").toString())) {
wrapper.eq("del_flag", params.get("delFlag"));
} else {
wrapper.in(true, "del_flag", 0, 5);
@ -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());
}
@ -266,7 +264,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}
break;
case TSINGTAO_XHA: {
if ("基础设施" .equals(resourceDTO.getType())) { // 基础设施
if ("基础设施".equals(resourceDTO.getType())) { // 基础设施
logger.info("西海岸基础设施");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
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()));
//区级要根据行政区划多加一层结构
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<>();
map.put("type", item.getKey());
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.setDelFlag(0);
attrEntity.setAttrType("文件类型");
if ("f49561afc7204f008c4bb3cd821eb6ba" .equals(index)) {
if ("f49561afc7204f008c4bb3cd821eb6ba".equals(index)) {
attrEntity.setAttrValue("政府公报");
} else {
attrEntity.setAttrValue("政策解读");