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 eeb9df03..c472dd83 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 @@ -2195,8 +2195,9 @@ public class ResourceServiceImpl extends CrudServiceImpl> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); - List> resultList = getDeptTemp1(); + List> resultList = new ArrayList<>(); resultList.addAll(getDeptTemp2()); + resultList.addAll(getDeptTemp1()); resultList.addAll(getDeptTemp4()); Map countMap = new HashMap<>(); @@ -2381,9 +2382,10 @@ public class ResourceServiceImpl extends CrudServiceImpl> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params); Map>> typeCountListMap = // 市级部门 typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("2")).collect(Collectors.groupingBy(m -> m.get("dept_id").toString())); - List> resultList = getDeptTemp1(); - resultList.addAll(getDeptTemp2()); - resultList.addAll(getDeptTemp4()); + List> resultList = new ArrayList<>(); + resultList.addAll(getDeptTemp2()); // 区级区域 + resultList.addAll(getDeptTemp1()); // 市级部门 + resultList.addAll(getDeptTemp4()); // 企业 Map countMap = new HashMap<>(); resultList = resultList.stream().map(index -> { if (typeCountListMap.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息 diff --git a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java index 1124861c..b152dc3e 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java @@ -94,12 +94,18 @@ public class SysDeptController { } } else { // 区域管理员 SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId()); - if (sysDeptDTO.getDistrict() != null) { + if (sysDeptDTO != null && sysDeptDTO.getDistrict() != null) { if (StringUtils.isNotEmpty(name)) { list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE `name` LIKE '%s' AND WHERE district = %d;", "%" + name + "%", sysDeptDTO.getDistrict())); } else { list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE district = %d;", sysDeptDTO.getDistrict())); } + } else { + if (StringUtils.isNotEmpty(name)) { + list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE `name` LIKE '%s';", "%" + name + "%")); + } else { + list = jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept;"); + } } } return new Result>>().ok(list);