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-api/src/main/java/cn/stylefeng/roses/kernel/system/api/RoleServiceApi.java b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/RoleServiceApi.java index dfe9996b1..11c1df6a8 100644 --- a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/RoleServiceApi.java +++ b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/RoleServiceApi.java @@ -28,6 +28,7 @@ import cn.stylefeng.roses.kernel.system.api.pojo.role.dto.SysRoleDTO; import cn.stylefeng.roses.kernel.system.api.pojo.role.dto.SysRoleMenuButtonDTO; import cn.stylefeng.roses.kernel.system.api.pojo.role.dto.SysRoleMenuDTO; import cn.stylefeng.roses.kernel.system.api.pojo.role.dto.SysRoleResourceDTO; +import cn.stylefeng.roses.kernel.system.api.pojo.role.request.SysRoleRequest; import java.util.List; import java.util.Set; @@ -118,4 +119,11 @@ public interface RoleServiceApi { */ List getRoleMenuButtonList(List roleIdList); + /** + * 获取所有角色列表 + * + * @author fengshuonan + * @date 2022/6/8 14:58 + */ + List getRoleSelectList(SysRoleRequest sysRoleRequest); } 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 * diff --git a/kernel-s-system/system-business-role/src/main/java/cn/stylefeng/roses/kernel/system/modular/role/controller/SysRoleController.java b/kernel-s-system/system-business-role/src/main/java/cn/stylefeng/roses/kernel/system/modular/role/controller/SysRoleController.java index 4a0ba3831..1dd6122f3 100644 --- a/kernel-s-system/system-business-role/src/main/java/cn/stylefeng/roses/kernel/system/modular/role/controller/SysRoleController.java +++ b/kernel-s-system/system-business-role/src/main/java/cn/stylefeng/roses/kernel/system/modular/role/controller/SysRoleController.java @@ -228,4 +228,15 @@ public class SysRoleController { return new SuccessResponseData<>(sysRoleService.getRoleDataScope(sysRoleRequest)); } + /** + * 获取角色下拉列表 + * + * @author fengshuonan + * @date 2022/6/8 14:57 + */ + @GetResource(name = "获取角色下拉列表", path = "/sysRole/getRoleSelectList") + public ResponseData> getRoleSelectList(SysRoleRequest sysRoleRequest) { + return new SuccessResponseData<>(sysRoleService.getRoleSelectList(sysRoleRequest)); + } + } diff --git a/kernel-s-system/system-business-role/src/main/java/cn/stylefeng/roses/kernel/system/modular/role/service/impl/SysRoleServiceImpl.java b/kernel-s-system/system-business-role/src/main/java/cn/stylefeng/roses/kernel/system/modular/role/service/impl/SysRoleServiceImpl.java index a1b374244..4658c4ed2 100644 --- a/kernel-s-system/system-business-role/src/main/java/cn/stylefeng/roses/kernel/system/modular/role/service/impl/SysRoleServiceImpl.java +++ b/kernel-s-system/system-business-role/src/main/java/cn/stylefeng/roses/kernel/system/modular/role/service/impl/SysRoleServiceImpl.java @@ -565,6 +565,22 @@ public class SysRoleServiceImpl extends ServiceImpl impl return sysRoleMenuButtons.parallelStream().map(item -> BeanUtil.copyProperties(item, SysRoleMenuButtonDTO.class)).collect(Collectors.toList()); } + @Override + public List getRoleSelectList(SysRoleRequest sysRoleRequest) { + + LambdaQueryWrapper wrapper = this.createWrapper(sysRoleRequest); + List list = this.list(wrapper); + + ArrayList sysRoleDTOS = new ArrayList<>(); + for (SysRole sysRole : list) { + SysRoleDTO sysRoleDTO = new SysRoleDTO(); + BeanUtil.copyProperties(sysRole, sysRoleDTO); + sysRoleDTOS.add(sysRoleDTO); + } + + return sysRoleDTOS; + } + /** * 获取系统角色 * diff --git a/pom.xml b/pom.xml index 612fb3681..4e511ceff 100644 --- a/pom.xml +++ b/pom.xml @@ -120,7 +120,7 @@ UTF-8 7.2.3 5.7.6 - 1.2.78 + 1.2.83 1.18.24 3.4.0 8.0.21