update 设置dept等级

This commit is contained in:
2023-11-10 15:14:54 +08:00
parent 75e9d5296f
commit 5daad34fe7
9 changed files with 43 additions and 14 deletions

View File

@@ -192,7 +192,7 @@ public class SysDeptServiceImpl implements SysDeptService {
}
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
// 更新deptLevel字段
if (StringUtils.isNotBlank(info.getDeptLevel())) {
if (StringUtils.isBlank(dept.getDeptLevel()) && StringUtils.isNotBlank(info.getDeptLevel())) {
dept.setDeptLevel(String.valueOf(Integer.parseInt(info.getDeptLevel()) + 1));
}
return deptMapper.insertDept(dept);
@@ -215,7 +215,7 @@ public class SysDeptServiceImpl implements SysDeptService {
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
// 更新deptLevel字段
if (StringUtils.isNotBlank(newParentDept.getDeptLevel())) {
if (StringUtils.isBlank(dept.getDeptLevel()) && StringUtils.isNotBlank(newParentDept.getDeptLevel())) {
dept.setDeptLevel(String.valueOf(Integer.parseInt(newParentDept.getDeptLevel()) + 1));
}
}