From 8cf8c8acd059969b9e79ad1c2f9f1921cc42d69c Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期二, 07 十一月 2023 11:38:19 +0800 Subject: [PATCH] 修复外链带端口出现的异常(I86J4B) --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 9bf8fe0..c5f3ce6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -49,6 +49,19 @@ } /** + * 查询部门树结构信息 + * + * @param dept 部门信息 + * @return 部门树信息集合 + */ + @Override + public List<TreeSelect> selectDeptTreeList(SysDept dept) + { + List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept); + return buildDeptTreeSelect(depts); + } + + /** * 构建前端所需要树结构 * * @param depts 部门列表 @@ -58,14 +71,9 @@ public List<SysDept> buildDeptTree(List<SysDept> depts) { List<SysDept> returnList = new ArrayList<SysDept>(); - List<Long> tempList = new ArrayList<Long>(); + List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList()); for (SysDept dept : depts) { - tempList.add(dept.getDeptId()); - } - for (Iterator<SysDept> iterator = depts.iterator(); iterator.hasNext();) - { - SysDept dept = (SysDept) iterator.next(); // 如果是顶级节点, 遍历该父节点的所有子节点 if (!tempList.contains(dept.getParentId())) { @@ -100,7 +108,7 @@ * @return 选中部门列表 */ @Override - public List<Integer> selectDeptListByRoleId(Long roleId) + public List<Long> selectDeptListByRoleId(Long roleId) { SysRole role = roleMapper.selectRoleById(roleId); return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly()); @@ -163,7 +171,7 @@ * @return 结果 */ @Override - public String checkDeptNameUnique(SysDept dept) + public boolean checkDeptNameUnique(SysDept dept) { Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId(); SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId()); -- Gitblit v1.9.2