| | |
| | | @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); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @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); |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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); |