From c3e13291b599b8754ab433c0cd4d2466e912dc0d Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Tue, 27 Jun 2023 00:35:58 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=907.6.0=E3=80=91=E3=80=90sys=E3=80=91?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BB=84=E7=BB=87=E6=9C=BA=E6=9E=84=E6=A0=91?= =?UTF-8?q?=E5=8E=BB=E9=87=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/service/impl/HrOrganizationServiceImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kernel-s-sys/sys-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/org/service/impl/HrOrganizationServiceImpl.java b/kernel-s-sys/sys-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/org/service/impl/HrOrganizationServiceImpl.java index 955ced647..f912e0284 100644 --- a/kernel-s-sys/sys-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/org/service/impl/HrOrganizationServiceImpl.java +++ b/kernel-s-sys/sys-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/org/service/impl/HrOrganizationServiceImpl.java @@ -36,14 +36,12 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import static cn.stylefeng.roses.kernel.rule.constants.SymbolConstant.LEFT_SQUARE_BRACKETS; import static cn.stylefeng.roses.kernel.rule.constants.SymbolConstant.RIGHT_SQUARE_BRACKETS; +import static java.util.stream.Collectors.toCollection; /** * 组织机构信息业务实现层 @@ -164,8 +162,13 @@ public class HrOrganizationServiceImpl extends ServiceImpl newNotRepeatList = hrOrganizationList.stream().collect( + Collectors.collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(HrOrganization::getOrgId))), + ArrayList::new)); + // 构建树形结构 - return new DefaultTreeBuildFactory().doTreeBuild(hrOrganizationList); + return new DefaultTreeBuildFactory().doTreeBuild(newNotRepeatList); } @Override