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
|
* @author fengshuonan
|
||||||
* @since 2024-01-16 20:10
|
* @since 2024-01-16 20:10
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue