From 3199f917e75ab685aac108e2f5610ccdd1e6c2b1 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 15 Nov 2022 15:33:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E8=83=BD=E5=8A=9B=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E9=83=A8=E9=97=A8=E7=BA=A7=E5=88=AB=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E8=B0=83=E8=8A=82=20=E6=89=80=E6=9C=89=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resource/service/impl/ResourceServiceImpl.java | 10 ++++++---- .../modules/sys/controller/SysDeptController.java | 8 +++++++- 2 files changed, 13 insertions(+), 5 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 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);