From 7db751ab74bd8c4e0fceca7510e918e9d1515483 Mon Sep 17 00:00:00 2001 From: mashuai Date: Wed, 30 Jul 2025 10:45:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/common/mapper/SelectMapper.java | 23 ++- .../service/impl/SelectServiceImpl.java | 37 +++- .../mapper/material/common/SelectMapper.xml | 195 +++++++++++++++++- 3 files changed, 239 insertions(+), 16 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java index 63371e04..491a96de 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java @@ -186,7 +186,7 @@ public interface SelectMapper { * @param bean * @return */ - List getTeamList(ProAuthorizeInfo bean); + List getTeamList(ProAuthorizeInfo bean); /** * 获取工程下拉选 @@ -257,4 +257,25 @@ public interface SelectMapper { * @return */ List getAgreementInfoByIdBack(SelectDto dto); + + /** + * 获取无需授权的项目部和后勤单位 + * @param bmUnit + * @return + */ + List getUnitListXm(BmUnit bmUnit); + + /** + * 获取项目部项目 + * @param bean + * @return + */ + List getUnitListPro(ProAuthorizeInfo bean); + + /** + * 获取部门项目 + * @param bmUnit + * @return + */ + BmUnit selectUnitByLeaseId(BmUnit bmUnit); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java index 89843627..8022b466 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java @@ -209,13 +209,29 @@ public class SelectServiceImpl implements SelectService { @Override public AjaxResult getTeamList(ProAuthorizeInfo bean) { + List groupList = new ArrayList<>(); + List list; try { - // 班组固定查询,typeId为1731 - return AjaxResult.success(mapper.getTeamList(bean)); + list = mapper.getUnitListPro(bean); + list = list.stream() + .filter(Objects::nonNull) + .filter(unit -> unit.getId() != null && unit.getParentId() != null) + .collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(list)) { + // 创建树形结构(数据集合作为参数) + ProjectTreeBuild treeBuild = new ProjectTreeBuild(list); + // 原查询结果转换树形结构 + groupList = treeBuild.buildTree(); + // 获取已授权班组,进行数据拼接 + List newList = mapper.getTeamList(bean); + if (CollectionUtils.isNotEmpty(newList)) { + groupList.addAll(newList); + } + } } catch (Exception e) { - log.error("班组-查询失败", e); - return AjaxResult.success(new ArrayList<>()); + log.error("单位类型树-查询失败", e); } + return AjaxResult.success(groupList); } /** @@ -267,7 +283,18 @@ public class SelectServiceImpl implements SelectService { List groupList = new ArrayList<>(); List list; try { - list = mapper.getUnitList(bmUnit); + list = mapper.getUnitListXm(bmUnit); + // 根据leaseId查询授权单位 + BmUnit info = mapper.selectUnitByLeaseId(bmUnit); + if (info != null && info.getUnitId() != null) { + // 根据单位id查询授权单位树 + bmUnit.setUnitId(info.getUnitId()); + List unitList = mapper.getUnitList(bmUnit); + if (CollectionUtils.isNotEmpty(unitList)) { + list.addAll(unitList); + } + + } list = list.stream() .filter(Objects::nonNull) .filter(unit -> unit.getId() != null && unit.getParentId() != null) diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml index 2a6e9a64..bf8df096 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml @@ -33,6 +33,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bu.dept_id = #{deptId} + + AND bu.unit_id = #{unitId} + UNION @@ -59,6 +62,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bu.dept_id = #{deptId} + + AND bu.unit_id = #{unitId} + UNION SELECT @@ -84,6 +90,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bu.dept_id = #{deptId} + + AND bu.unit_id = #{unitId} + ) ff ORDER BY LEVEL @@ -455,16 +464,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + + + + + +