mirror of https://gitee.com/stylefeng/roses
【7.6.0】【sys】【org】更新组织机构的查询接口,增加一个orgId条件
parent
c3e13291b5
commit
58fed480d7
|
@ -5,6 +5,7 @@ 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;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
||||||
|
import cn.stylefeng.roses.kernel.db.api.DbOperatorApi;
|
||||||
import cn.stylefeng.roses.kernel.db.api.context.DbOperatorContext;
|
import cn.stylefeng.roses.kernel.db.api.context.DbOperatorContext;
|
||||||
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
||||||
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||||
|
@ -61,6 +62,9 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
||||||
@Resource
|
@Resource
|
||||||
private SysUserOrgService sysUserOrgService;
|
private SysUserOrgService sysUserOrgService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DbOperatorApi dbOperatorApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(HrOrganizationRequest hrOrganizationRequest) {
|
public void add(HrOrganizationRequest hrOrganizationRequest) {
|
||||||
HrOrganization hrOrganization = new HrOrganization();
|
HrOrganization hrOrganization = new HrOrganization();
|
||||||
|
@ -303,6 +307,15 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
||||||
Integer statusFlag = hrOrganizationRequest.getStatusFlag();
|
Integer statusFlag = hrOrganizationRequest.getStatusFlag();
|
||||||
queryWrapper.eq(ObjectUtil.isNotNull(statusFlag), HrOrganization::getStatusFlag, statusFlag);
|
queryWrapper.eq(ObjectUtil.isNotNull(statusFlag), HrOrganization::getStatusFlag, statusFlag);
|
||||||
|
|
||||||
|
// 如果查询条件有orgId,则查询指定机构下的子机构
|
||||||
|
Long orgId = hrOrganizationRequest.getOrgId();
|
||||||
|
if (orgId != null) {
|
||||||
|
// 查询orgId对应的所有子机构,包含本orgId
|
||||||
|
Set<Long> subOrgIdList = dbOperatorApi.findSubListByParentId("hr_organization", "org_pids", "org_id", orgId);
|
||||||
|
subOrgIdList.add(orgId);
|
||||||
|
queryWrapper.nested(i -> i.in(HrOrganization::getOrgId, subOrgIdList));
|
||||||
|
}
|
||||||
|
|
||||||
// 根据排序正序查询
|
// 根据排序正序查询
|
||||||
queryWrapper.orderByAsc(HrOrganization::getOrgSort);
|
queryWrapper.orderByAsc(HrOrganization::getOrgSort);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue