mirror of https://gitee.com/stylefeng/roses
【8.3.3】【system】【cache】更新组织机构缓存的应用
parent
243be73ea5
commit
e3c48a828f
|
@ -9,6 +9,8 @@ import cn.stylefeng.roses.kernel.sys.api.pojo.org.CompanyDeptDTO;
|
|||
|
||||
/**
|
||||
* 获取公司名称的处理
|
||||
* <p>
|
||||
* 优先从缓存获取数据,进行名称的获取
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2024-01-16 20:10
|
||||
|
|
|
@ -9,6 +9,8 @@ import java.util.HashMap;
|
|||
|
||||
/**
|
||||
* 组织机构id格式化为获取机构的详情
|
||||
* <p>
|
||||
* 优先从缓存获取数据,进行名称的获取
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/7/17 15:36
|
||||
|
|
|
@ -7,6 +7,8 @@ import cn.stylefeng.roses.kernel.sys.api.OrganizationServiceApi;
|
|||
|
||||
/**
|
||||
* 获取机构名称的处理
|
||||
* <p>
|
||||
* 采用组织机构详情缓存,加速获取
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/7/14 16:46
|
||||
|
|
|
@ -44,6 +44,12 @@ public class HrOrganizationDTO {
|
|||
@ChineseDescription("主键")
|
||||
private Long orgId;
|
||||
|
||||
/**
|
||||
* 组织机构类型:1-公司,2-部门
|
||||
*/
|
||||
@ChineseDescription("组织机构类型:1-公司,2-部门")
|
||||
private Integer orgType;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
|
|
|
@ -344,8 +344,11 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
|||
|
||||
// 查询父级是否是公司
|
||||
Long orgParentId = hrOrganization.getOrgParentId();
|
||||
HrOrganization parentOrgInfo = this.getById(orgParentId);
|
||||
return this.getOrgCompanyInfo(parentOrgInfo);
|
||||
HrOrganizationDTO parentOrgInfo = this.getOrgInfo(orgParentId);
|
||||
|
||||
HrOrganization parentEntity = new HrOrganization();
|
||||
BeanUtil.copyProperties(parentOrgInfo, parentEntity);
|
||||
return this.getOrgCompanyInfo(parentEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -356,16 +359,14 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
|||
}
|
||||
|
||||
// 查询组织机构对应的信息
|
||||
LambdaQueryWrapper<HrOrganization> hrOrganizationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
hrOrganizationLambdaQueryWrapper.eq(HrOrganization::getOrgId, orgId);
|
||||
hrOrganizationLambdaQueryWrapper.select(HrOrganization::getOrgType, HrOrganization::getOrgId, HrOrganization::getOrgParentId);
|
||||
HrOrganization hrOrganization = this.getOne(hrOrganizationLambdaQueryWrapper, false);
|
||||
|
||||
if (hrOrganization == null) {
|
||||
HrOrganizationDTO orgInfo = this.getOrgInfo(orgId);
|
||||
if (orgInfo == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 查询机构对应的公司部门信息
|
||||
HrOrganization hrOrganization = new HrOrganization();
|
||||
BeanUtil.copyProperties(orgInfo, hrOrganization);
|
||||
return this.getOrgCompanyInfo(hrOrganization);
|
||||
}
|
||||
|
||||
|
@ -384,8 +385,9 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
|||
// 查询组织机构对应的信息
|
||||
LambdaQueryWrapper<HrOrganization> hrOrganizationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
hrOrganizationLambdaQueryWrapper.eq(HrOrganization::getOrgId, orgId);
|
||||
hrOrganizationLambdaQueryWrapper.select(HrOrganization::getOrgId, HrOrganization::getOrgParentId, HrOrganization::getOrgPids,
|
||||
HrOrganization::getOrgName, HrOrganization::getOrgShortName, HrOrganization::getOrgSort, HrOrganization::getOrgCode);
|
||||
hrOrganizationLambdaQueryWrapper.select(HrOrganization::getOrgId, HrOrganization::getOrgType,
|
||||
HrOrganization::getOrgParentId, HrOrganization::getOrgPids, HrOrganization::getOrgName,
|
||||
HrOrganization::getOrgShortName, HrOrganization::getOrgSort, HrOrganization::getOrgCode);
|
||||
HrOrganization hrOrganization = this.getOne(hrOrganizationLambdaQueryWrapper, false);
|
||||
|
||||
if (ObjectUtil.isEmpty(hrOrganization)) {
|
||||
|
@ -578,16 +580,9 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
|||
return OrgConstants.NONE_PARENT_ORG;
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<HrOrganization> hrOrganizationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
hrOrganizationLambdaQueryWrapper.eq(HrOrganization::getOrgId, orgId);
|
||||
hrOrganizationLambdaQueryWrapper.select(HrOrganization::getOrgName);
|
||||
HrOrganization one = this.getOne(hrOrganizationLambdaQueryWrapper);
|
||||
|
||||
if (one != null) {
|
||||
return one.getOrgName();
|
||||
}
|
||||
|
||||
return OrgConstants.NONE_PARENT_ORG;
|
||||
// 获取组织机构详情
|
||||
HrOrganizationDTO orgInfo = this.getOrgInfo(orgId);
|
||||
return orgInfo.getOrgName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue