修改部门添加可以多个父级
This commit is contained in:
parent
2f132a33e1
commit
63cc2de9b9
@ -71,12 +71,15 @@ namespace ZR.Service.System
|
|||||||
{
|
{
|
||||||
SysDept info = DeptRepository.GetFirst(it => it.DeptId == dept.ParentId);
|
SysDept info = DeptRepository.GetFirst(it => it.DeptId == dept.ParentId);
|
||||||
//如果父节点不为正常状态,则不允许新增子节点
|
//如果父节点不为正常状态,则不允许新增子节点
|
||||||
if (!UserConstants.DEPT_NORMAL.Equals(info.Status))
|
if (info != null && !UserConstants.DEPT_NORMAL.Equals(info?.Status))
|
||||||
{
|
{
|
||||||
throw new CustomException("部门停用,不允许新增");
|
throw new CustomException("部门停用,不允许新增");
|
||||||
}
|
}
|
||||||
|
dept.Ancestors = "";
|
||||||
dept.Ancestors = info.Ancestors + "," + dept.ParentId;
|
if (info != null)
|
||||||
|
{
|
||||||
|
dept.Ancestors = info.Ancestors + "," + dept.ParentId;
|
||||||
|
}
|
||||||
return DeptRepository.Add(dept);
|
return DeptRepository.Add(dept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user