Commit 90f0ea13e0c1d6323012d6803930aa10b3a9e6d9
1 parent
258b4c3d
fix:【system】增加 node 的 parentId 为空下的兼容性,对应 https://t.zsxq.com/ktTUO
Showing
1 changed file
with
2 additions
and
3 deletions
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java
| @@ -40,8 +40,6 @@ public interface AuthConvert { | @@ -40,8 +40,6 @@ public interface AuthConvert { | ||
| 40 | .build(); | 40 | .build(); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | - AuthPermissionInfoRespVO.MenuVO convertTreeNode(MenuDO menu); | ||
| 44 | - | ||
| 45 | /** | 43 | /** |
| 46 | * 将菜单列表,构建成菜单树 | 44 | * 将菜单列表,构建成菜单树 |
| 47 | * | 45 | * |
| @@ -60,7 +58,8 @@ public interface AuthConvert { | @@ -60,7 +58,8 @@ public interface AuthConvert { | ||
| 60 | // 构建菜单树 | 58 | // 构建菜单树 |
| 61 | // 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。 | 59 | // 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。 |
| 62 | Map<Long, AuthPermissionInfoRespVO.MenuVO> treeNodeMap = new LinkedHashMap<>(); | 60 | Map<Long, AuthPermissionInfoRespVO.MenuVO> treeNodeMap = new LinkedHashMap<>(); |
| 63 | - menuList.forEach(menu -> treeNodeMap.put(menu.getId(), AuthConvert.INSTANCE.convertTreeNode(menu))); | 61 | + menuList.forEach(menu -> treeNodeMap.put(menu.getId(), |
| 62 | + BeanUtils.toBean(menu, AuthPermissionInfoRespVO.MenuVO.class))); | ||
| 64 | // 处理父子关系 | 63 | // 处理父子关系 |
| 65 | treeNodeMap.values().stream().filter(node -> ObjUtil.notEqual(node.getParentId(), ID_ROOT)).forEach(childNode -> { | 64 | treeNodeMap.values().stream().filter(node -> ObjUtil.notEqual(node.getParentId(), ID_ROOT)).forEach(childNode -> { |
| 66 | // 获得父节点 | 65 | // 获得父节点 |