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

This commit is contained in:
秋辞未寒
2025-02-17 19:59:04 +08:00
parent 4c5ab7bcaf
commit e67aa57cb3
2 changed files with 8 additions and 2 deletions

View File

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

View File

@@ -298,8 +298,10 @@ public class SysDeptServiceImpl implements ISysDeptService {
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);
}