修改部门功能

This commit is contained in:
qitz
2023-11-01 13:59:47 +08:00
parent 7c1f59d651
commit 6a49e0199f
6 changed files with 36 additions and 13 deletions
@@ -211,13 +211,16 @@ public class SysDeptServiceImpl implements ISysDeptService
@Override
public int insertDept(SysDept dept)
{
SysDept info = deptMapper.selectDeptById(dept.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
{
throw new ServiceException("部门停用,不允许新增");
Long parentId = dept.getParentId();
if(parentId!=null){
SysDept info = deptMapper.selectDeptById(dept.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
{
throw new ServiceException("部门停用,不允许新增");
}
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
}
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
return deptMapper.insertDept(dept);
}