【7.2.3】更新获取组织机构树列表

pull/30/head
fengshuonan 2022-06-08 14:48:29 +08:00
parent f916102f84
commit e4f8f254dd
3 changed files with 43 additions and 0 deletions

View File

@ -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<OrganizationTreeNode> getOrgTreeList(HrOrganizationRequest hrOrganizationRequest);
}

View File

@ -199,4 +199,18 @@ public class HrOrganizationController {
return new SuccessResponseData<>(zTreeNodes);
}
/**
*
* <p>
*
*
* @author fengshuonan
* @date 2021/1/9 18:37
*/
@GetResource(name = "获取所有组织机构树(树形)", path = "/hrOrganization/getOrgTreeList")
public ResponseData<List<OrganizationTreeNode>> getOrgTreeList(HrOrganizationRequest hrOrganizationRequest) {
List<OrganizationTreeNode> list = hrOrganizationService.getOrgTreeList(hrOrganizationRequest);
return new SuccessResponseData<>(list);
}
}

View File

@ -369,6 +369,25 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
return hrOrganizationDTO;
}
@Override
public List<OrganizationTreeNode> getOrgTreeList(HrOrganizationRequest hrOrganizationRequest) {
List<OrganizationTreeNode> treeNodeList = CollectionUtil.newArrayList();
// 获取所有组织机构
LambdaQueryWrapper<HrOrganization> wrapper = createWrapper(hrOrganizationRequest);
List<HrOrganization> hrOrganizationList = this.list(wrapper);
// 组装节点
for (HrOrganization hrOrganization : hrOrganizationList) {
OrganizationTreeNode treeNode = OrganizationFactory.parseOrganizationTreeNode(hrOrganization);
treeNodeList.add(treeNode);
}
// 节点组装成树
return new DefaultTreeBuildFactory<OrganizationTreeNode>().doTreeBuild(treeNodeList);
}
/**
* wrapper
*