Commit e5f439aecd04dc759dbbcde6c1f71c875f7b91af
1 parent
86a413f5
1063 【轻量级 PR】:关闭菜单还是会显示的问题修复
Showing
1 changed file
with
8 additions
and
6 deletions
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,17 +140,19 @@ public class MenuServiceImpl implements MenuService { | ||
| 140 | return true; | 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 | Long parentId = node.getParentId(); | 150 | Long parentId = node.getParentId(); |
| 145 | if (ObjUtil.equal(parentId, ID_ROOT)) { | 151 | if (ObjUtil.equal(parentId, ID_ROOT)) { |
| 146 | - if (CommonStatusEnum.isDisable(node.getStatus())) { | ||
| 147 | - disabledMenuCache.add(node.getId()); | ||
| 148 | - return true; | ||
| 149 | - } | ||
| 150 | return false; | 152 | return false; |
| 151 | } | 153 | } |
| 152 | 154 | ||
| 153 | - // 2. 继续遍历 parent 节点 | 155 | + // 3. 继续遍历 parent 节点 |
| 154 | MenuDO parent = menuMap.get(parentId); | 156 | MenuDO parent = menuMap.get(parentId); |
| 155 | if (parent == null || isMenuDisabled(parent, menuMap, disabledMenuCache)) { | 157 | if (parent == null || isMenuDisabled(parent, menuMap, disabledMenuCache)) { |
| 156 | disabledMenuCache.add(node.getId()); | 158 | disabledMenuCache.add(node.getId()); |