From e7242d40110c8a157867acd2d1a1718fb640d4c5 Mon Sep 17 00:00:00 2001 From: zlyx <1242874891@qq.com> Date: 星期五, 17 二月 2023 16:02:04 +0800 Subject: [PATCH] fix 修正 SysTenantServiceImpl#deleteWithValidByIds 超管租户可以被删除的问题, 加上 id 校验 ; fix 修正 tenant/index.vue handleUpdate 租户套餐回显问题 ; --- ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 453d98f..7b71a6f 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -127,6 +127,9 @@ @Override public SysDeptVo selectDeptById(Long deptId) { SysDeptVo dept = baseMapper.selectVoById(deptId); + if (ObjectUtil.isNull(dept)) { + return null; + } SysDeptVo parentDept = baseMapper.selectVoOne(new LambdaQueryWrapper<SysDept>() .select(SysDept::getDeptName).eq(SysDept::getDeptId, dept.getParentId())); dept.setParentName(ObjectUtil.isNotNull(parentDept) ? parentDept.getDeptName() : null); @@ -142,13 +145,13 @@ @Override public String selectDeptNameByIds(String deptIds) { List<String> list = new ArrayList<>(); - for (Long id : Arrays.stream(deptIds.split(",")).map(Long::parseLong).toList()) { + for (Long id : StringUtils.splitTo(deptIds, Convert::toLong)) { SysDeptVo vo = SpringUtils.getAopProxy(this).selectDeptById(id); if (ObjectUtil.isNotNull(vo)) { list.add(vo.getDeptName()); } } - return String.join(",", list); + return String.join(StringUtils.SEPARATOR, list); } /** @@ -213,7 +216,7 @@ */ @Override public void checkDeptDataScope(Long deptId) { - if (!LoginHelper.isAdmin()) { + if (!LoginHelper.isSuperAdmin()) { SysDeptBo dept = new SysDeptBo(); dept.setDeptId(deptId); List<SysDeptVo> depts = this.selectDeptList(dept); @@ -237,7 +240,7 @@ throw new ServiceException("閮ㄩ棬鍋滅敤锛屼笉鍏佽鏂板"); } SysDept dept = BeanUtil.toBean(bo, SysDept.class); - dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); + dept.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + dept.getParentId()); return baseMapper.insert(dept); } @@ -254,7 +257,7 @@ SysDept newParentDept = baseMapper.selectById(dept.getParentId()); SysDept oldDept = baseMapper.selectById(dept.getDeptId()); if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(oldDept)) { - String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); + String newAncestors = newParentDept.getAncestors() + StringUtils.SEPARATOR + newParentDept.getDeptId(); String oldAncestors = oldDept.getAncestors(); dept.setAncestors(newAncestors); updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); -- Gitblit v1.9.3