【统一认证】组织更新叶子结点修改

This commit is contained in:
2025-11-11 14:50:55 +08:00
parent 92033a17cb
commit 40ab4b65dd
@@ -295,6 +295,7 @@ public class LoginAnYanServiceImpl implements ILoginAnYanService {
String parentId = "";
String[] unitCodes = levelPath.split("\\|");
for (String unitCode : unitCodes) {
//判断是否为顶级组织
if (StringUtils.isBlank(unitCode) || "00000100".equals(unitCode)) {
parentId = sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>()
.and(wrapper ->
@@ -343,17 +344,18 @@ public class LoginAnYanServiceImpl implements ILoginAnYanService {
);
}
if (save) {
// 仅在父节点为叶子节点时更新为非叶子节点
SysDepart parentDepart = sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>()
.eq(SysDepart::getId, parentId)
);
if (parentDepart != null && !parentDepart.getIzLeaf().equals(1)) {
// 判断父级组织是否为叶子结点,0不是叶子节点,1是叶子节点,是则更新为非叶子结点
if (parentDepart != null && parentDepart.getIzLeaf().equals(1)) {
sysDepartService.update(new LambdaUpdateWrapper<SysDepart>()
.eq(SysDepart::getId, parentId)
.set(SysDepart::getIzLeaf, "1")
.set(SysDepart::getIzLeaf, CommonConstant.NOT_LEAF)
);
}
}
// 父id赋值
parentId = depart.getId();
orgId = depart.getId();
}