!1063 关闭菜单还是会显示的问题修复

Merge pull request !1063 from Vmo/N/A
This commit is contained in:
芋道源码 2024-08-31 00:15:21 +00:00 committed by Gitee
commit 3618f8e873
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 8 additions and 6 deletions

View File

@ -140,17 +140,19 @@ public class MenuServiceImpl implements MenuService {
return true; return true;
} }
// 1. 遍历到 parentId 为根节点则无需判断 // 1. 先判断自身是否禁用
if (CommonStatusEnum.isDisable(node.getStatus())) {
disabledMenuCache.add(node.getId());
return true;
}
// 2. 遍历到 parentId 为根节点则无需判断
Long parentId = node.getParentId(); Long parentId = node.getParentId();
if (ObjUtil.equal(parentId, ID_ROOT)) { if (ObjUtil.equal(parentId, ID_ROOT)) {
if (CommonStatusEnum.isDisable(node.getStatus())) {
disabledMenuCache.add(node.getId());
return true;
}
return false; return false;
} }
// 2. 继续遍历 parent 节点 // 3. 继续遍历 parent 节点
MenuDO parent = menuMap.get(parentId); MenuDO parent = menuMap.get(parentId);
if (parent == null || isMenuDisabled(parent, menuMap, disabledMenuCache)) { if (parent == null || isMenuDisabled(parent, menuMap, disabledMenuCache)) {
disabledMenuCache.add(node.getId()); disabledMenuCache.add(node.getId());