| | |
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | import cn.hutool.core.util.ObjectUtil;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | |
| | | * @return 部门信息集合
|
| | | */
|
| | | @Override
|
| | | @DataScope(deptAlias = "d")
|
| | | @DataScope(tenantIdFelid = "d")
|
| | | public List<SysDept> selectDeptList(SysDept dept)
|
| | | {
|
| | | return deptMapper.selectDeptList(dept);
|
| | |
| | | @Override
|
| | | public void checkDeptDataScope(Long deptId)
|
| | | {
|
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId()))
|
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId()) && StringUtils.isNotNull(deptId))
|
| | | {
|
| | | SysDept dept = new SysDept();
|
| | | dept.setDeptId(deptId);
|
| | |
| | | {
|
| | | SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
| | | // 如果父节点不为正常状态,则不允许新增子节点
|
| | | if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
|
| | | if (ObjectUtil.isNotNull(info) && !UserConstants.DEPT_NORMAL.equals(info.getStatus()))
|
| | | {
|
| | | throw new ServiceException("部门停用,不允许新增");
|
| | | }
|
| | | dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
| | | if(ObjectUtil.isNotNull(info) && 0L!=dept.getParentId()){
|
| | | dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
| | | }else{
|
| | | dept.setAncestors("0");
|
| | | }
|
| | | return deptMapper.insertDept(dept);
|
| | | }
|
| | |
|
| | |
| | | deptMapper.updateDeptStatusNormal(deptIds);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public SysDept selectDeptByDeptName(String deptName) {
|
| | | return deptMapper.selectDeptByDeptName(deptName);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改子元素关系
|
| | | *
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 查询顶层部门id
|
| | | * @param deptId
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public Long maxLevelDeptId(Long deptId) {
|
| | | return deptMapper.maxLevelDeptId(deptId);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 递归列表
|
| | | */
|
| | | private void recursionFn(List<SysDept> list, SysDept t)
|