mirror of
https://gitee.com/yudaocode/yudao-boot-mini.git
synced 2026-03-22 05:27:15 +08:00
fix:【system】增加 node 的 parentId 为空下的兼容性,对应 https://t.zsxq.com/ktTUO
This commit is contained in:
@@ -40,8 +40,6 @@ public interface AuthConvert {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthPermissionInfoRespVO.MenuVO convertTreeNode(MenuDO menu);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将菜单列表,构建成菜单树
|
* 将菜单列表,构建成菜单树
|
||||||
*
|
*
|
||||||
@@ -60,7 +58,8 @@ public interface AuthConvert {
|
|||||||
// 构建菜单树
|
// 构建菜单树
|
||||||
// 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。
|
// 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。
|
||||||
Map<Long, AuthPermissionInfoRespVO.MenuVO> treeNodeMap = new LinkedHashMap<>();
|
Map<Long, AuthPermissionInfoRespVO.MenuVO> treeNodeMap = new LinkedHashMap<>();
|
||||||
menuList.forEach(menu -> treeNodeMap.put(menu.getId(), AuthConvert.INSTANCE.convertTreeNode(menu)));
|
menuList.forEach(menu -> treeNodeMap.put(menu.getId(),
|
||||||
|
BeanUtils.toBean(menu, AuthPermissionInfoRespVO.MenuVO.class)));
|
||||||
// 处理父子关系
|
// 处理父子关系
|
||||||
treeNodeMap.values().stream().filter(node -> ObjUtil.notEqual(node.getParentId(), ID_ROOT)).forEach(childNode -> {
|
treeNodeMap.values().stream().filter(node -> ObjUtil.notEqual(node.getParentId(), ID_ROOT)).forEach(childNode -> {
|
||||||
// 获得父节点
|
// 获得父节点
|
||||||
|
|||||||
Reference in New Issue
Block a user