Commit e5f439aecd04dc759dbbcde6c1f71c875f7b91af

Authored by YunaiV
1 parent 86a413f5

1063 【轻量级 PR】:关闭菜单还是会显示的问题修复

yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java
... ... @@ -140,17 +140,19 @@ public class MenuServiceImpl implements MenuService {
140 140 return true;
141 141 }
142 142  
143   - // 1. 遍历到 parentId 为根节点,则无需判断
  143 + // 1. 先判断自身是否禁用
  144 + if (CommonStatusEnum.isDisable(node.getStatus())) {
  145 + disabledMenuCache.add(node.getId());
  146 + return true;
  147 + }
  148 +
  149 + // 2. 遍历到 parentId 为根节点,则无需判断
144 150 Long parentId = node.getParentId();
145 151 if (ObjUtil.equal(parentId, ID_ROOT)) {
146   - if (CommonStatusEnum.isDisable(node.getStatus())) {
147   - disabledMenuCache.add(node.getId());
148   - return true;
149   - }
150 152 return false;
151 153 }
152 154  
153   - // 2. 继续遍历 parent 节点
  155 + // 3. 继续遍历 parent 节点
154 156 MenuDO parent = menuMap.get(parentId);
155 157 if (parent == null || isMenuDisabled(parent, menuMap, disabledMenuCache)) {
156 158 disabledMenuCache.add(node.getId());
... ...