diff --git a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/OrganizationServiceApi.java b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/OrganizationServiceApi.java index ed77f8557..04fdd090d 100644 --- a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/OrganizationServiceApi.java +++ b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/OrganizationServiceApi.java @@ -25,6 +25,8 @@ package cn.stylefeng.roses.kernel.system.api; import cn.stylefeng.roses.kernel.system.api.pojo.organization.HrOrganizationDTO; +import cn.stylefeng.roses.kernel.system.api.pojo.organization.HrOrganizationRequest; +import cn.stylefeng.roses.kernel.system.api.pojo.organization.OrganizationTreeNode; import java.util.List; @@ -52,4 +54,12 @@ public interface OrganizationServiceApi { * @date 2022/3/8 23:32 */ HrOrganizationDTO getOrgDetail(Long orgId); + + /** + * 获取组织机构下拉选择树 + * + * @author fengshuonan + * @date 2022/6/8 14:40 + */ + List getOrgTreeList(HrOrganizationRequest hrOrganizationRequest); } diff --git a/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/controller/HrOrganizationController.java b/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/controller/HrOrganizationController.java index cef98d48b..dd8ea4319 100644 --- a/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/controller/HrOrganizationController.java +++ b/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/controller/HrOrganizationController.java @@ -199,4 +199,18 @@ public class HrOrganizationController { return new SuccessResponseData<>(zTreeNodes); } + /** + * 获取所有组织机构树(树形) + *

+ * 一般用在组织机构选择界面 + * + * @author fengshuonan + * @date 2021/1/9 18:37 + */ + @GetResource(name = "获取所有组织机构树(树形)", path = "/hrOrganization/getOrgTreeList") + public ResponseData> getOrgTreeList(HrOrganizationRequest hrOrganizationRequest) { + List list = hrOrganizationService.getOrgTreeList(hrOrganizationRequest); + return new SuccessResponseData<>(list); + } + } diff --git a/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/service/impl/HrOrganizationServiceImpl.java b/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/service/impl/HrOrganizationServiceImpl.java index afdf8ccd0..06410659d 100644 --- a/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/service/impl/HrOrganizationServiceImpl.java +++ b/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/service/impl/HrOrganizationServiceImpl.java @@ -369,6 +369,25 @@ public class HrOrganizationServiceImpl extends ServiceImpl getOrgTreeList(HrOrganizationRequest hrOrganizationRequest) { + + List treeNodeList = CollectionUtil.newArrayList(); + + // 获取所有组织机构 + LambdaQueryWrapper wrapper = createWrapper(hrOrganizationRequest); + List hrOrganizationList = this.list(wrapper); + + // 组装节点 + for (HrOrganization hrOrganization : hrOrganizationList) { + OrganizationTreeNode treeNode = OrganizationFactory.parseOrganizationTreeNode(hrOrganization); + treeNodeList.add(treeNode); + } + + // 节点组装成树 + return new DefaultTreeBuildFactory().doTreeBuild(treeNodeList); + } + /** * 创建组织架构的通用条件查询wrapper *