From 961073ec96bfbb920f9afd952052c20b3791eb4d Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期二, 15 二月 2022 10:45:04 +0800 Subject: [PATCH] update 优化 TreeBuildUtils 工具 使用反射自动获取顶级父id --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 0dd441b..621dc07 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -60,8 +60,7 @@ 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()) -- Gitblit v1.9.3