From 51c64834743fd24254ca56cfcb258fbf622d6545 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Mon, 8 Apr 2024 18:15:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E4=B8=8B=E6=8B=89=E6=A0=91,?= =?UTF-8?q?=E6=B7=B1=E5=BA=A6=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/organization/entity/chart/CompanyTreePO.java | 1 + src/com/engine/organization/service/impl/ChartServiceImpl.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/com/engine/organization/entity/chart/CompanyTreePO.java b/src/com/engine/organization/entity/chart/CompanyTreePO.java index 54918bac..ce287e19 100644 --- a/src/com/engine/organization/entity/chart/CompanyTreePO.java +++ b/src/com/engine/organization/entity/chart/CompanyTreePO.java @@ -23,6 +23,7 @@ public class CompanyTreePO { private String key; private boolean disabled; private int level; + private int depth; public boolean getIsLeaf() { return isLeaf; diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index 89b91174..eda5af50 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -554,6 +554,7 @@ public class ChartServiceImpl extends Service implements ChartService { private void getChildDepartment(CompanyTreePO parentDepartment, String sql, List departmentTree) { RecordSet rs = new RecordSet(); rs.executeQuery(sql, parentDepartment.getId()); + int depth=1; while (rs.next()) { CompanyTreePO build = CompanyTreePO.builder() .id(rs.getString("id")) @@ -566,7 +567,9 @@ public class ChartServiceImpl extends Service implements ChartService { .build(); getChildDepartment(build, sql, departmentTree); parentDepartment.setLeaf(false); + depth = build.getDepth()+1; } + parentDepartment.setDepth(depth); departmentTree.add(parentDepartment); }