Skip to content

Commit

Permalink
!1063 关闭菜单还是会显示的问题修复
Browse files Browse the repository at this point in the history
Merge pull request !1063 from Vmo/N/A
  • Loading branch information
YunaiV authored and gitee-org committed Aug 31, 2024
2 parents 930edcf + 5f5e8c1 commit 3618f8e
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,19 @@ private boolean isMenuDisabled(MenuDO node, Map<Long, MenuDO> menuMap, Set<Long>
return true;
}

// 1. 遍历到 parentId 为根节点,则无需判断
// 1. 先判断自身是否禁用
if (CommonStatusEnum.isDisable(node.getStatus())) {
disabledMenuCache.add(node.getId());
return true;
}

// 2. 遍历到 parentId 为根节点,则无需判断
Long parentId = node.getParentId();
if (ObjUtil.equal(parentId, ID_ROOT)) {
if (CommonStatusEnum.isDisable(node.getStatus())) {
disabledMenuCache.add(node.getId());
return true;
}
return false;
}

// 2. 继续遍历 parent 节点
// 3. 继续遍历 parent 节点
MenuDO parent = menuMap.get(parentId);
if (parent == null || isMenuDisabled(parent, menuMap, disabledMenuCache)) {
disabledMenuCache.add(node.getId());
Expand Down

0 comments on commit 3618f8e

Please sign in to comment.