mirror of https://gitee.com/stylefeng/roses
【7.4.0】【org】获取指定组织机构下所有的子组织机构信息
parent
60c8db2a81
commit
f95f34972b
|
@ -38,7 +38,6 @@ import cn.stylefeng.roses.kernel.system.api.enums.OrgTypeEnum;
|
|||
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 cn.stylefeng.roses.kernel.system.api.pojo.user.request.SysUserRequest;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrganization;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.service.HrOrganizationService;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.wrapper.OrgExpandWrapper;
|
||||
|
@ -264,8 +263,20 @@ public class HrOrganizationController {
|
|||
* @author yxx
|
||||
* @since 2023/03/05 09:49
|
||||
*/
|
||||
@GetResource(name = "组织机构_选择器", path = "/hrOrganization/selector",requiredPermission = false)
|
||||
@GetResource(name = "组织机构_选择器", path = "/hrOrganization/selector", requiredPermission = false)
|
||||
public ResponseData<List<SimpleDict>> selector(HrOrganizationRequest request) {
|
||||
return new SuccessResponseData<>(hrOrganizationService.selector(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定组织机构下所有的子组织机构信息
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/4/14 21:49
|
||||
*/
|
||||
@GetResource(name = "获取指定组织机构下所有的子组织机构信息", path = "/hrOrganization/getSubOrgList")
|
||||
public ResponseData<List<HrOrganizationDTO>> getSubOrgList(HrOrganizationRequest request) {
|
||||
return new SuccessResponseData<>(hrOrganizationService.getSubOrgList(request));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
|||
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
|
||||
import cn.stylefeng.roses.kernel.rule.tree.ztree.ZTreeNode;
|
||||
import cn.stylefeng.roses.kernel.system.api.OrganizationServiceApi;
|
||||
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 cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrganization;
|
||||
|
@ -143,8 +144,18 @@ public interface HrOrganizationService extends IService<HrOrganization>, Organiz
|
|||
|
||||
/**
|
||||
* 组织机构选择器
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @return 选择列表
|
||||
*/
|
||||
List<SimpleDict> selector(HrOrganizationRequest request);
|
||||
|
||||
/**
|
||||
* 获取组织机构下所有的子组织机构信息
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/4/14 21:50
|
||||
*/
|
||||
List<HrOrganizationDTO> getSubOrgList(HrOrganizationRequest request);
|
||||
|
||||
}
|
||||
|
|
|
@ -345,6 +345,39 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
|||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HrOrganizationDTO> getSubOrgList(HrOrganizationRequest request) {
|
||||
|
||||
Long orgId = request.getOrgId();
|
||||
String searchText = request.getSearchText();
|
||||
|
||||
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 查询未删除状态的
|
||||
queryWrapper.eq(HrOrganization::getDelFlag, YesOrNotEnum.N.getCode());
|
||||
|
||||
// 根据排序升序排列,序号越小越在前
|
||||
queryWrapper.orderByAsc(HrOrganization::getOrgSort);
|
||||
|
||||
// 根据条件模糊查询
|
||||
if (ObjectUtil.isNotEmpty(searchText)) {
|
||||
queryWrapper.like(HrOrganization::getOrgName, searchText);
|
||||
}
|
||||
|
||||
// 查找当前和子集所有的组织机构
|
||||
if (ObjectUtil.isNotEmpty(orgId)) {
|
||||
queryWrapper.nested(
|
||||
item -> item.and(i -> i.eq(HrOrganization::getOrgId, orgId).or().like(HrOrganization::getOrgPids, orgId)));
|
||||
}
|
||||
|
||||
List<HrOrganization> list = this.list(queryWrapper);
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
return BeanUtil.copyToList(list, HrOrganizationDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HrOrganizationDTO> orgList() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue