update 优化 TreeBuildUtils 工具 使用反射自动获取顶级父id

This commit is contained in:
疯狂的狮子li
2022-02-15 10:45:04 +08:00
parent e2b786d97b
commit 961073ec96
3 changed files with 10 additions and 6 deletions

View File

@ -60,8 +60,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
if (CollUtil.isEmpty(depts)) {
return CollUtil.newArrayList();
}
Long parentId = depts.get(0).getParentId();
return TreeBuildUtils.build(depts, parentId, (dept, tree) ->
return TreeBuildUtils.build(depts, (dept, tree) ->
tree.setId(dept.getDeptId())
.setParentId(dept.getParentId())
.setName(dept.getDeptName())

View File

@ -181,8 +181,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
if (CollUtil.isEmpty(menus)) {
return CollUtil.newArrayList();
}
Long parentId = menus.get(0).getParentId();
return TreeBuildUtils.build(menus, parentId, (menu, tree) ->
return TreeBuildUtils.build(menus, (menu, tree) ->
tree.setId(menu.getMenuId())
.setParentId(menu.getParentId())
.setName(menu.getMenuName())