mirror of https://gitee.com/stylefeng/roses
【7.6.0】【sys】【org】更新获取子一级机构信息集合
parent
58fed480d7
commit
3f1a101fca
|
@ -121,4 +121,13 @@ public interface HrOrganizationService extends IService<HrOrganization> {
|
||||||
*/
|
*/
|
||||||
HomeCompanyInfo orgStatInfo();
|
HomeCompanyInfo orgStatInfo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定组织机构id的所有子一级的机构
|
||||||
|
*
|
||||||
|
* @return 返回结果包含参数orgId
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/27 14:33
|
||||||
|
*/
|
||||||
|
List<Long> getSubOrgIdListOneLevel(Long orgId);
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package cn.stylefeng.roses.kernel.sys.modular.org.service.impl;
|
package cn.stylefeng.roses.kernel.sys.modular.org.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
@ -270,6 +271,23 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
||||||
return homeCompanyInfo;
|
return homeCompanyInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Long> getSubOrgIdListOneLevel(Long orgId) {
|
||||||
|
LambdaQueryWrapper<HrOrganization> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(HrOrganization::getOrgParentId, orgId);
|
||||||
|
wrapper.select(HrOrganization::getOrgId);
|
||||||
|
List<HrOrganization> subOrgList = this.list(wrapper);
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(subOrgList)) {
|
||||||
|
return ListUtil.list(false, orgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Long> subOrgIdList = subOrgList.stream().map(HrOrganization::getOrgId).collect(Collectors.toList());
|
||||||
|
subOrgIdList.add(orgId);
|
||||||
|
|
||||||
|
return subOrgIdList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取信息
|
* 获取信息
|
||||||
*
|
*
|
||||||
|
@ -311,9 +329,8 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
||||||
Long orgId = hrOrganizationRequest.getOrgId();
|
Long orgId = hrOrganizationRequest.getOrgId();
|
||||||
if (orgId != null) {
|
if (orgId != null) {
|
||||||
// 查询orgId对应的所有子机构,包含本orgId
|
// 查询orgId对应的所有子机构,包含本orgId
|
||||||
Set<Long> subOrgIdList = dbOperatorApi.findSubListByParentId("hr_organization", "org_pids", "org_id", orgId);
|
List<Long> subOrgIdListOneLevel = this.getSubOrgIdListOneLevel(orgId);
|
||||||
subOrgIdList.add(orgId);
|
queryWrapper.nested(i -> i.in(HrOrganization::getOrgId, subOrgIdListOneLevel));
|
||||||
queryWrapper.nested(i -> i.in(HrOrganization::getOrgId, subOrgIdList));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据排序正序查询
|
// 根据排序正序查询
|
||||||
|
|
Loading…
Reference in New Issue