update 优化 根部门祖级列表常量和备注,以避免歧义

This commit is contained in:
秋辞未寒 2025-02-13 17:39:30 +08:00
parent 78abb617ce
commit 2746af21f0
2 changed files with 9 additions and 2 deletions

View File

@ -72,4 +72,9 @@ public interface SystemConstants {
*/
Long SUPER_ADMIN_ID = 1L;
/**
* 根部门祖级列表
*/
String ROOT_DEPT_ANCESTORS = "0";
}

View File

@ -323,8 +323,10 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
dept.setAncestors(oldDept.getAncestors());
}
int result = baseMapper.updateById(dept);
if (SystemConstants.NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
&& !StringUtils.equals(SystemConstants.NORMAL, dept.getAncestors())) {
// 如果部门状态为启用且部门祖级列表不为空且部门祖级列表不等于根部门祖级列表如果部门祖级列表不等于根部门祖级列表则说明存在上级部门
if (SystemConstants.NORMAL.equals(dept.getStatus())
&& StringUtils.isNotEmpty(dept.getAncestors())
&& !StringUtils.equals(SystemConstants.ROOT_DEPT_ANCESTORS, dept.getAncestors())) {
// 如果该部门是启用状态则启用该部门的所有上级部门
updateParentDeptStatusNormal(dept);
}