能力统计详情 资源名称模糊查询与缓存

This commit is contained in:
wangliwen 2022-11-03 09:41:47 +08:00
parent 66acc1a318
commit 82a0b3537b
3 changed files with 35 additions and 7 deletions

View File

@ -19,6 +19,8 @@ import java.util.Map;
*/ */
@Mapper @Mapper
public interface ResourceDao extends BaseDao<ResourceEntity> { public interface ResourceDao extends BaseDao<ResourceEntity> {
static final String selectCensusResourceTableKey = "selectCensusResourceTable";
static final String selectCensusApplyTableKey = "selectCensusApplyTable";
Integer deleteByIds(@Param("ids") List<Long> idList); Integer deleteByIds(@Param("ids") List<Long> idList);
@ -193,8 +195,10 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<Map<String, Object>> selectDeptDetailTypeCountList(Map params); List<Map<String, Object>> selectDeptDetailTypeCountList(Map params);
@Cacheable(value = selectCensusResourceTableKey, key = "#p0")
List<Map> selectCensusResourceTable(Map params); List<Map> selectCensusResourceTable(Map params);
@Cacheable(value = selectCensusApplyTableKey, key = "#p0")
List<Map> selectCensusApplyTable(Map params); List<Map> selectCensusApplyTable(Map params);
List<Map> selectCollectList(@Param("resourceType") String resourceType, @Param("attrType") String attrType); List<Map> selectCollectList(@Param("resourceType") String resourceType, @Param("attrType") String attrType);

View File

@ -106,6 +106,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
private static final String SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY = "selectDTOPageSpecilTotal"; private static final String SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY = "selectDTOPageSpecilTotal";
private static final String SELECTWITHATTRS_KEY = "selectWithAttrs"; private static final String SELECTWITHATTRS_KEY = "selectWithAttrs";
private static final String SELECTCENSUSRESOURCETABLEKEY = "selectCensusResourceTable";
private static final String selectCensusApplyTableKey = "selectCensusApplyTable";
@Value("${system.startDay}") @Value("${system.startDay}")
private String systemDay; private String systemDay;
@ -236,13 +240,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
@Override @Override
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void save(ResourceDTO dto) { public void save(ResourceDTO dto) {
super.save(dto); super.save(dto);
} }
@Override @Override
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void update(ResourceDTO dto) { public void update(ResourceDTO dto) {
super.update(dto); super.update(dto);
} }
@ -250,7 +254,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
@Transactional @Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void insertWithAttrs(ResourceDTO dto) { public void insertWithAttrs(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity(); ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity); BeanUtils.copyProperties(dto, resourceEntity);
@ -314,7 +318,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
@Transactional @Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, selectCensusApplyTableKey, SELECTCENSUSRESOURCETABLEKEY}, allEntries = true)
public void createMixAbility(ResourceDTO dto) { public void createMixAbility(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity(); ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity); BeanUtils.copyProperties(dto, resourceEntity);
@ -357,7 +361,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
@Transactional @Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void deleteWithAttrs(JSONObject jsonObject) { public void deleteWithAttrs(JSONObject jsonObject) {
JSONArray jsonArray = jsonObject.getJSONArray("ids"); JSONArray jsonArray = jsonObject.getJSONArray("ids");
List<Long> idList = jsonArray.toJavaList(Long.class); List<Long> idList = jsonArray.toJavaList(Long.class);
@ -371,7 +375,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
@Transactional @Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void updateWithAttrs(ResourceDTO dto) { public void updateWithAttrs(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity(); ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity); BeanUtils.copyProperties(dto, resourceEntity);
@ -1185,7 +1189,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
* 同步知识库 * 同步知识库
*/ */
@Override @Override
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void KnowledgeBase() { public void KnowledgeBase() {
final List<String> knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList()); final List<String> knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList());
final int pageSize = CPU_NUM * 10; final int pageSize = CPU_NUM * 10;

View File

@ -80,4 +80,24 @@
diskPersistent="true" diskPersistent="true"
memoryStoreEvictionPolicy="LRU"/> memoryStoreEvictionPolicy="LRU"/>
<!-- selectCensusResourceTable缓存 -->
<cache name="selectCensusResourceTable"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="60"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="true"
memoryStoreEvictionPolicy="LRU"/>
<!-- selectCensusResourceTable缓存 -->
<cache name="selectCensusApplyTable"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="60"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="true"
memoryStoreEvictionPolicy="LRU"/>
</ehcache> </ehcache>