diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java index 8439b7d940..45fa05d7cf 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java @@ -85,7 +85,7 @@ public interface IssueProjectTagDictDao extends BaseDao selectTagListByCustomer(@Param("customerId") String customerId); /** - * @Description 根据类别查询客户下标签 + * @Description 根据类别查询客户下默认标签 * @param categories * @param customerId * @return java.util.List diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java index b5ee686890..b041b7efd4 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java @@ -269,26 +269,31 @@ public class IssueProjectTagDictRedis { CategoryTagInitFormDTO customerIdParam = new CategoryTagInitFormDTO(); customerIdParam.setCustomerId(customerId); if (!CollectionUtils.isEmpty(redisUtils.keys(GovIssueRedisKeys.getGovernmentTagKey(customerId, null)))){ + //缓存不为空 if(CollectionUtils.isEmpty(preResult) || CollectionUtils.isEmpty(preResult.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME))) { if (ifOtherOnly || CollectionUtils.isEmpty(category)) { //补偿全部默认标签 categoryDictService.init(customerIdParam); - db.addAll(poolDao.selectTagListByCustomer(customerId)); + db.addAll(poolDao.selectTagByCategory(null, customerId, customerId)); } else { if (NumConstant.ZERO <= poolDao.selectCountByCustomerId(customerId)) { categoryDictService.init(customerIdParam); } else { //只插入category中的标签 - tagDictService.insertBatch(poolDao.selectTagByCategory(category, "default", customerId)); - db.addAll(poolDao.selectTagsByCustomerIdAndTagIds(customerId, category)); + List missingTags = poolDao.selectTagByCategory(category, "default", customerId); + if(!CollectionUtils.isEmpty(missingTags)){ + tagDictService.insertBatch(missingTags); + db.addAll(missingTags);} } } } + }else{ + //缓存为空 if (NumConstant.ZERO <= poolDao.selectCountByCustomerId(customerId)) { categoryDictService.init(customerIdParam); } - db.addAll(poolDao.selectTagListByCustomer(customerId)); + db.addAll(poolDao.selectTagByCategory(null, customerId, customerId)); } if(CollectionUtils.isEmpty(preResult) || CollectionUtils.isEmpty(preResult.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))){ diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml index 8bd6bbba53..51b847163b 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml @@ -92,16 +92,31 @@ #{targetCustomerId} as customerId, - TAG_NAME,CATEGORY_ID,IS_DEFAULT,ISSUE_USE_COUNT,PROJECT_USE_COUNT,IS_DISABLE,DEL_FLAG,REVISION + TAG_NAME,CATEGORY_ID,IS_DEFAULT, + + + ISSUE_USE_COUNT, + + + IFNULL(ISSUE_USE_COUNT,0)+IFNULL(PROJECT_USE_COUNT,0) AS issueUseCount, + + + PROJECT_USE_COUNT, + IS_DISABLE,DEL_FLAG,REVISION FROM ISSUE_PROJECT_TAG_DICT WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} - - CATEGORY_ID = #{categoryId} - + AND + IS_DEFAULT = '0' + + + CATEGORY_ID = #{categoryId} + + +