【8.3.3】【system】【cache】更新组织机构缓存的应用

pull/62/head
stylefeng 2025-01-10 13:57:00 +08:00
parent 243be73ea5
commit e3c48a828f
5 changed files with 27 additions and 20 deletions

View File

@ -9,6 +9,8 @@ import cn.stylefeng.roses.kernel.sys.api.pojo.org.CompanyDeptDTO;
/** /**
* *
* <p>
*
* *
* @author fengshuonan * @author fengshuonan
* @since 2024-01-16 20:10 * @since 2024-01-16 20:10

View File

@ -9,6 +9,8 @@ import java.util.HashMap;
/** /**
* id * id
* <p>
*
* *
* @author fengshuonan * @author fengshuonan
* @since 2023/7/17 15:36 * @since 2023/7/17 15:36

View File

@ -7,6 +7,8 @@ import cn.stylefeng.roses.kernel.sys.api.OrganizationServiceApi;
/** /**
* *
* <p>
*
* *
* @author fengshuonan * @author fengshuonan
* @since 2023/7/14 16:46 * @since 2023/7/14 16:46

View File

@ -44,6 +44,12 @@ public class HrOrganizationDTO {
@ChineseDescription("主键") @ChineseDescription("主键")
private Long orgId; private Long orgId;
/**
* 1-2-
*/
@ChineseDescription("组织机构类型1-公司2-部门")
private Integer orgType;
/** /**
* id * id
*/ */

View File

@ -344,8 +344,11 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
// 查询父级是否是公司 // 查询父级是否是公司
Long orgParentId = hrOrganization.getOrgParentId(); Long orgParentId = hrOrganization.getOrgParentId();
HrOrganization parentOrgInfo = this.getById(orgParentId); HrOrganizationDTO parentOrgInfo = this.getOrgInfo(orgParentId);
return this.getOrgCompanyInfo(parentOrgInfo);
HrOrganization parentEntity = new HrOrganization();
BeanUtil.copyProperties(parentOrgInfo, parentEntity);
return this.getOrgCompanyInfo(parentEntity);
} }
@Override @Override
@ -356,16 +359,14 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
} }
// 查询组织机构对应的信息 // 查询组织机构对应的信息
LambdaQueryWrapper<HrOrganization> hrOrganizationLambdaQueryWrapper = new LambdaQueryWrapper<>(); HrOrganizationDTO orgInfo = this.getOrgInfo(orgId);
hrOrganizationLambdaQueryWrapper.eq(HrOrganization::getOrgId, orgId); if (orgInfo == null) {
hrOrganizationLambdaQueryWrapper.select(HrOrganization::getOrgType, HrOrganization::getOrgId, HrOrganization::getOrgParentId);
HrOrganization hrOrganization = this.getOne(hrOrganizationLambdaQueryWrapper, false);
if (hrOrganization == null) {
return null; return null;
} }
// 查询机构对应的公司部门信息 // 查询机构对应的公司部门信息
HrOrganization hrOrganization = new HrOrganization();
BeanUtil.copyProperties(orgInfo, hrOrganization);
return this.getOrgCompanyInfo(hrOrganization); return this.getOrgCompanyInfo(hrOrganization);
} }
@ -384,8 +385,9 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
// 查询组织机构对应的信息 // 查询组织机构对应的信息
LambdaQueryWrapper<HrOrganization> hrOrganizationLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<HrOrganization> hrOrganizationLambdaQueryWrapper = new LambdaQueryWrapper<>();
hrOrganizationLambdaQueryWrapper.eq(HrOrganization::getOrgId, orgId); hrOrganizationLambdaQueryWrapper.eq(HrOrganization::getOrgId, orgId);
hrOrganizationLambdaQueryWrapper.select(HrOrganization::getOrgId, HrOrganization::getOrgParentId, HrOrganization::getOrgPids, hrOrganizationLambdaQueryWrapper.select(HrOrganization::getOrgId, HrOrganization::getOrgType,
HrOrganization::getOrgName, HrOrganization::getOrgShortName, HrOrganization::getOrgSort, HrOrganization::getOrgCode); HrOrganization::getOrgParentId, HrOrganization::getOrgPids, HrOrganization::getOrgName,
HrOrganization::getOrgShortName, HrOrganization::getOrgSort, HrOrganization::getOrgCode);
HrOrganization hrOrganization = this.getOne(hrOrganizationLambdaQueryWrapper, false); HrOrganization hrOrganization = this.getOne(hrOrganizationLambdaQueryWrapper, false);
if (ObjectUtil.isEmpty(hrOrganization)) { if (ObjectUtil.isEmpty(hrOrganization)) {
@ -578,16 +580,9 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
return OrgConstants.NONE_PARENT_ORG; return OrgConstants.NONE_PARENT_ORG;
} }
LambdaQueryWrapper<HrOrganization> hrOrganizationLambdaQueryWrapper = new LambdaQueryWrapper<>(); // 获取组织机构详情
hrOrganizationLambdaQueryWrapper.eq(HrOrganization::getOrgId, orgId); HrOrganizationDTO orgInfo = this.getOrgInfo(orgId);
hrOrganizationLambdaQueryWrapper.select(HrOrganization::getOrgName); return orgInfo.getOrgName();
HrOrganization one = this.getOne(hrOrganizationLambdaQueryWrapper);
if (one != null) {
return one.getOrgName();
}
return OrgConstants.NONE_PARENT_ORG;
} }
@Override @Override