Browse Source

①修改默认标签的排序方法

②修改搜索标签时查询为null时的补偿方法
③新增批量修改二级分类下的标签在缓存中的"是否禁用"属性
dev_shibei_match
wangchao 4 years ago
parent
commit
17d4db86d5
  1. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java
  2. 33
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java
  3. 106
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java
  4. 7
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java
  5. 106
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml

12
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java

@ -357,6 +357,18 @@ public class RedisUtils {
return typedTuples; return typedTuples;
} }
public <T> Set<T> zReverseRange(String key, long start, long end, Class<T> clazz) {
Set<Object> objects = redisTemplate.opsForZSet().reverseRange(key, start, end);
if(CollectionUtils.isEmpty(objects)) return null;
return objects.stream().map(o->{
try {
T target = clazz.newInstance();
BeanUtils.copyProperties(o, target);
return target;
}catch (Exception e){throw new RenException("convert error");}
}).collect(Collectors.toSet());
}
/** /**
* @Description 标签使用数量缓存更新 * @Description 标签使用数量缓存更新
* @param key * @param key

33
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java

@ -92,10 +92,41 @@ public interface IssueProjectTagDictDao extends BaseDao<IssueProjectTagDictEntit
* @author wangc * @author wangc
* @date 2020.12.10 10:07 * @date 2020.12.10 10:07
*/ */
List<IssueProjectTagDictEntity> selectTagByCategory(@Param("categories") List<String> categories,@Param("customerId") String customerId,@Param("isDefault")String isDefault); List<IssueProjectTagDictEntity> selectTagByCategory(@Param("categories") List<String> categories,@Param("customerId") String customerId,@Param("targetCustomerId") String targetCustomerId);
/**
* @Description 查询客户下的标签数量
* @param customerId
* @return int
* @author wangc
* @date 2021.03.23 16:51
*/
int selectCountByCustomerId(@Param("customerId") String customerId);
/**
* @Description 查询客户下自定义标签
* @param customerId
* @return java.util.List<com.epmet.entity.IssueProjectTagDictEntity>
* @author wangc
* @date 2021.03.23 16:56
*/
List<IssueProjectTagDictEntity> selectCustomizedByCustomerId(@Param("customerId") String customerId);
/**
* @Description 根据传入的二级分类Id查询默认标签
* 当categories为空时查询全部默认分类的标签排序规则先按照二级分类的上级分类的Sort排序(asc)然后按照二级分类的Sort排序(asc)然后按照标签名拼音排序
* 当categories不为空时按照传入的二级分类的顺序排序然后按照标签名拼音排序
* @param customerId
* @param categories
* @return java.util.List<com.epmet.dto.result.IssueCategoryTagResultDTO>
* @author wangc
* @date 2021.03.23 15:19
*/
List<IssueCategoryTagResultDTO> selectDefault(@Param("customerId") String customerId,@Param("categories") List<String> categories);
/** /**
* @Description 根据客户Id和标签Id集合查询标签的基础信息(标签名标签码标签所属分类) * @Description 根据客户Id和标签Id集合查询标签的基础信息(标签名标签码标签所属分类)
* 不管标签是否被禁用都可以更新热度因此这个查询不能加是否禁用的限制
* @param customerId * @param customerId
* @param tagIds * @param tagIds
* @return java.util.List<com.epmet.entity.IssueProjectTagDictEntity> * @return java.util.List<com.epmet.entity.IssueProjectTagDictEntity>

106
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java

@ -29,6 +29,7 @@ import com.epmet.dto.result.IssueCategoryTagResultDTO;
import com.epmet.entity.IssueProjectCategoryDictEntity; import com.epmet.entity.IssueProjectCategoryDictEntity;
import com.epmet.entity.IssueProjectTagDictEntity; import com.epmet.entity.IssueProjectTagDictEntity;
import com.epmet.service.IssueProjectCategoryDictService; import com.epmet.service.IssueProjectCategoryDictService;
import com.epmet.service.IssueProjectTagDictService;
import com.epmet.utils.ModuleConstants; import com.epmet.utils.ModuleConstants;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -65,6 +66,8 @@ public class IssueProjectTagDictRedis {
private IssueProjectCategoryDictDao categoryDictDao; private IssueProjectCategoryDictDao categoryDictDao;
@Autowired @Autowired
private IssueProjectCategoryDictService categoryDictService; private IssueProjectCategoryDictService categoryDictService;
@Autowired
private IssueProjectTagDictService tagDictService;
public void delete(Object[] ids) { public void delete(Object[] ids) {
} }
@ -101,12 +104,10 @@ public class IssueProjectTagDictRedis {
boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false); boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false);
Map<String,List<IssueCategoryTagResultDTO>> result = new HashMap<>(); Map<String,List<IssueCategoryTagResultDTO>> result = new HashMap<>();
//传入的categories不会只包含"其他"这个分类,因为情况下ifOtherOnly为true,直接传入null
List<IssueProjectTagDictEntity> _default = poolDao.selectTagByCategory(ifOtherOnly || CollectionUtils.isEmpty(category) ? null : category, customerId, NumConstant.ZERO_STR);//默认 List<IssueCategoryTagResultDTO> _default = poolDao.selectDefault(customerId,ifOtherOnly ? null : category);
if(!CollectionUtils.isEmpty(_default)){ if(!CollectionUtils.isEmpty(_default)){
result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,_default.stream().map(o -> { result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,_default);
IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(o,IssueCategoryTagResultDTO.class);
tag.setName(o.getTagName()); return tag;}).collect(Collectors.toList()));
}else log.error("there is no default tag data in database , customerId : {}",customerId); }else log.error("there is no default tag data in database , customerId : {}",customerId);
@ -127,16 +128,19 @@ public class IssueProjectTagDictRedis {
result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,customizedResult); result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,customizedResult);
} }
//默认、自定义标签,只要有一个是空就触发补偿
//不信任缓存数据 //默认、自定义标签,只要有一个是空就触发补偿
if(!CollectionUtils.isEmpty(result) && !CollectionUtils.isEmpty(result.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)) //不信任缓存数据
if(!CollectionUtils.isEmpty(result) && !CollectionUtils.isEmpty(result.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME))
&& !CollectionUtils.isEmpty(result.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))) && !CollectionUtils.isEmpty(result.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME)))
return result; return result;
log.warn("fetch customer govern tag cache blankly,customerId:{},now begin compensation...", customerId); log.warn("fetch customer govern tag cache blankly,customerId:{},now begin compensation...", customerId);
Map<String,List<IssueCategoryTagResultDTO>> compensate = compensate(customerId, category, ifOtherOnly); Map<String,List<IssueCategoryTagResultDTO>> compensate = compensate(customerId, category, ifOtherOnly,result);
if (CollectionUtils.isEmpty(compensate)) { if (CollectionUtils.isEmpty(compensate)) {
log.error("compensation failure or there is no tag data in database!!"); log.error("compensation failure or there is no tag data in database!!");
@ -235,7 +239,7 @@ public class IssueProjectTagDictRedis {
log.warn("fetch customer govern tag cache blankly,customerId:{},now begin compensation...", customerId); log.warn("fetch customer govern tag cache blankly,customerId:{},now begin compensation...", customerId);
Map<String,List<IssueCategoryTagResultDTO>> compensate = compensate(customerId, category, ifOtherOnly); Map<String,List<IssueCategoryTagResultDTO>> compensate = compensate(customerId, category, ifOtherOnly,null);
if (CollectionUtils.isEmpty(compensate)) { if (CollectionUtils.isEmpty(compensate)) {
log.error("compensation failure or there is no tag data in database!!"); log.error("compensation failure or there is no tag data in database!!");
@ -249,10 +253,7 @@ public class IssueProjectTagDictRedis {
/** /**
* @Description category为空则补偿全部返回默认标签和自定义标签补偿全部 * @Description 如果之前查询的结果为空说明默认与自定义都没有
* category仅包含"其他"这个分类的Id时返回同上补偿全部
* category不为空且不只有"其他"这个分类的Id时则返回并补偿集合中的类别标签以及自定义标签
* 默认标签不按照热度排序自定义标签按照热度排序
* *
* *
* @param customerId * @param customerId
@ -261,17 +262,38 @@ public class IssueProjectTagDictRedis {
* @author wangc * @author wangc
* @date 2020.12.10 09:34 * @date 2020.12.10 09:34
*/ */
public Map<String,List<IssueCategoryTagResultDTO>> compensate(String customerId,List<String> category,boolean ifOtherOnly){ public Map<String,List<IssueCategoryTagResultDTO>> compensate(String customerId,List<String> category,boolean ifOtherOnly,Map<String,List<IssueCategoryTagResultDTO>> preResult){
List<IssueProjectTagDictEntity> db = poolDao.selectTagByCategory(ifOtherOnly || CollectionUtils.isEmpty(category) ? null : category, customerId, null); List<IssueProjectTagDictEntity> db = new LinkedList<>();
if(CollectionUtils.isEmpty(db) && (ifOtherOnly || CollectionUtils.isEmpty(category))){ if(CollectionUtils.isEmpty(preResult) || CollectionUtils.isEmpty(preResult.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME))){
CategoryTagInitFormDTO customerIdParam = new CategoryTagInitFormDTO(); customerIdParam.setCustomerId(customerId); CategoryTagInitFormDTO customerIdParam = new CategoryTagInitFormDTO(); customerIdParam.setCustomerId(customerId);
categoryDictService.init(customerIdParam); if(ifOtherOnly || CollectionUtils.isEmpty(category)) {
db = poolDao.selectTagByCategory(ifOtherOnly || CollectionUtils.isEmpty(category) ? null : category, customerId, null); //补偿全部默认标签
categoryDictService.init(customerIdParam);
db.addAll(poolDao.selectTagListByCustomer(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));
}
}
}
if(CollectionUtils.isEmpty(preResult) || CollectionUtils.isEmpty(preResult.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))){
//先去数据库查询自定义,为空则是最终结果,不为空则补偿
List<IssueProjectTagDictEntity> customizedTags = poolDao.selectCustomizedByCustomerId(customerId);
if(!CollectionUtils.isEmpty(customizedTags)){
db.addAll(customizedTags);
}
} }
// key -> redisKey // key -> redisKey
// value -> [key : score ; value : object] // value -> [key : score ; value : object]
Map<String,Map<Integer,List<IssueCategoryTagResultDTO>>> fulfilled = new HashMap<>(); Map<String,Map<Integer,List<IssueCategoryTagResultDTO>>> fulfilled = new HashMap<>();
@ -310,9 +332,12 @@ public class IssueProjectTagDictRedis {
Map<String,List<IssueCategoryTagResultDTO>> result = new HashMap<>(); Map<String,List<IssueCategoryTagResultDTO>> result = new HashMap<>();
//默认标签:按照分类排序 Mapper返回的查询结果是有序的 //默认标签:按照分类排序 Mapper返回的查询结果是有序的
result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,CollectionUtils.isEmpty(db) ? null : db.stream().filter(o -> !StringUtils.equals(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,o.getCategoryId())).map(entity -> { //result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,CollectionUtils.isEmpty(db) ? null : db.stream().filter(o -> !StringUtils.equals(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,o.getCategoryId())).map(entity -> {
IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(entity,IssueCategoryTagResultDTO.class); // IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(entity,IssueCategoryTagResultDTO.class);
tag.setName(entity.getTagName()); return tag;}).collect(Collectors.toList())); // tag.setName(entity.getTagName()); return tag;}).collect(Collectors.toList()));
result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,poolDao.selectDefault(customerId,ifOtherOnly ? null : category));
//自定义标签:按照热度排序 sorted(Comparator.comparing(IssueProjectTagDictEntity :: getIssueUseCount).reversed()) //自定义标签:按照热度排序 sorted(Comparator.comparing(IssueProjectTagDictEntity :: getIssueUseCount).reversed())
result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,CollectionUtils.isEmpty(db) ? null : db.stream().filter(o -> StringUtils.equals(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,o.getCategoryId())).sorted(Comparator.comparing(IssueProjectTagDictEntity :: getIssueUseCount).reversed()).map(entity -> { result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,CollectionUtils.isEmpty(db) ? null : db.stream().filter(o -> StringUtils.equals(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,o.getCategoryId())).sorted(Comparator.comparing(IssueProjectTagDictEntity :: getIssueUseCount).reversed()).map(entity -> {
IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(entity,IssueCategoryTagResultDTO.class); IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(entity,IssueCategoryTagResultDTO.class);
@ -388,7 +413,42 @@ public class IssueProjectTagDictRedis {
* @date 2021.03.22 16:20 * @date 2021.03.22 16:20
*/ */
public void updateTagAvailabilityBySecondCategoryIds(String customerId,List<String>secondCategoryIds,String availableFlag){ public void updateTagAvailabilityBySecondCategoryIds(String customerId,List<String>secondCategoryIds,String availableFlag){
if(CollectionUtils.isEmpty(secondCategoryIds)) return;
secondCategoryIds.forEach(cid -> {
String key = GovIssueRedisKeys.getGovernmentTagKey(customerId, cid);
Set<ZSetOperations.TypedTuple<Object>> tagTuples =
redisUtils.zReverseRangeWithScores(key, NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG));
if(!CollectionUtils.isEmpty(tagTuples)){
Map<Double, Set<IssueCategoryTagResultDTO>> heatMap = new HashMap<>();
tagTuples.forEach(tuple -> {
Set<IssueCategoryTagResultDTO> queue = heatMap.get(tuple.getValue());
if((CollectionUtils.isEmpty(queue))) queue = new HashSet<>();
IssueCategoryTagResultDTO ele = parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class);
ele.setIsDisable(availableFlag);
queue.add(ele);
heatMap.put((Double) tuple.getValue(),queue);
});
List<IssueCategoryTagResultDTO> customizedResult = new LinkedList<>();
heatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> {
customizedResult.addAll(heatMap.get(count));
});
redisUtils.delete(key);
redisTemplate.executePipelined((RedisCallback) connection -> {
heatMap.forEach((score,set) -> {
set.forEach(o -> {
connection.zSetCommands().zIncrBy(redisTemplate.getKeySerializer().serialize(key),
score ,
redisTemplate.getValueSerializer().serialize(o));
});
});
return null;
});
}
});
} }
public <T> T parseObject(Object o,Class<T> clazz){ public <T> T parseObject(Object o,Class<T> clazz){

7
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java

@ -40,6 +40,7 @@ import com.epmet.feign.GovProjectOpenFeignClient;
import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; import com.epmet.project.dto.result.ProjectCategoryDictResultDTO;
import com.epmet.redis.IssueProjectCategoryDictRedis; import com.epmet.redis.IssueProjectCategoryDictRedis;
import com.epmet.redis.IssueProjectTagDictRedis;
import com.epmet.service.IssueProjectCategoryDictService; import com.epmet.service.IssueProjectCategoryDictService;
import com.epmet.service.IssueProjectTagDictService; import com.epmet.service.IssueProjectTagDictService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
@ -80,6 +81,8 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
private OperCrmOpenFeignClient operCrmOpenFeignClient; private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired @Autowired
private IssueProjectTagDictDao issueProjectTagDictDao; private IssueProjectTagDictDao issueProjectTagDictDao;
@Autowired
private IssueProjectTagDictRedis dictRedis;
@Override @Override
public PageData<IssueProjectCategoryDictDTO> page(Map<String, Object> params) { public PageData<IssueProjectCategoryDictDTO> page(Map<String, Object> params) {
@ -269,8 +272,8 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
logger.error(String.format("修改标签信息状态失败,客户Id->%s,分类Id->%s", formDTO.getCustomerId(), formDTO.getCategoryId())); logger.error(String.format("修改标签信息状态失败,客户Id->%s,分类Id->%s", formDTO.getCustomerId(), formDTO.getCategoryId()));
throw new RuntimeException("分类、标签信息修改失败!"); throw new RuntimeException("分类、标签信息修改失败!");
} }
//4.修改缓存中标签状态 todo //4.修改缓存中标签状态
dictRedis.updateTagAvailabilityBySecondCategoryIds(formDTO.getCustomerId(),formDTO.getSecondCategorylist(),formDTO.getType());
} }
/** /**

106
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml

@ -88,37 +88,87 @@
<!-- 根据类别查询客户下标签 --> <!-- 根据类别查询客户下标签 -->
<select id="selectTagByCategory" resultType="com.epmet.entity.IssueProjectTagDictEntity"> <select id="selectTagByCategory" resultType="com.epmet.entity.IssueProjectTagDictEntity">
SELECT SELECT
tag.ID, ID,
tag.TAG_NAME, <if test='null != targetCustomerId and "" != targetCustomerId'>
#{targetCustomerId} as customerId,
</if>
TAG_NAME,CATEGORY_ID,IS_DEFAULT,ISSUE_USE_COUNT,PROJECT_USE_COUNT,IS_DISABLE,DEL_FLAG,REVISION
FROM
ISSUE_PROJECT_TAG_DICT
WHERE
DEL_FLAG = '0'
AND
CUSTOMER_ID = #{customerId}
<foreach collection="categories" item="categoryId" open="AND ( " separator=" OR " close=" )">
CATEGORY_ID = #{categoryId}
</foreach>
</select>
<select id="selectCountByCustomerId" resultType="int">
SELECT COUNT(id) FROM ISSUE_PROJECT_CATEGORY_DICT
WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId}
</select>
<select id="selectCustomizedByCustomerId" resultType="com.epmet.entity.IssueProjectTagDictEntity">
SELECT
ID,
TAG_NAME,
IFNULL(tag.CATEGORY_ID,'customize') AS categoryId, IFNULL(tag.CATEGORY_ID,'customize') AS categoryId,
tag.IS_DEFAULT, IS_DEFAULT,
(IFNULL(tag.ISSUE_USE_COUNT,0) + IFNULL(tag.PROJECT_USE_COUNT,0)) AS issueUseCount (IFNULL(ISSUE_USE_COUNT,0) + IFNULL(PROJECT_USE_COUNT,0)) AS issueUseCount,
IS_DISABLE
FROM ISSUE_PROJECT_CATEGORY_DICT
WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} AND IS_DEFAULT = '0'
</select>
<select id="selectDefault" resultType="com.epmet.dto.result.IssueCategoryTagResultDTO">
SELECT
tag.ID,
tag.TAG_NAME AS NAME,
tag.category_id,
tag.IS_DISABLE
FROM
ISSUE_PROJECT_TAG_DICT tag
INNER JOIN (
SELECT
c1.id,
c1.CATEGORY_NAME,
c1.CATEGORY_CODE,
c2.sort AS pSort,
c1.sort
FROM FROM
ISSUE_PROJECT_TAG_DICT tag LEFT JOIN ISSUE_PROJECT_CATEGORY_DICT type ON tag.CATEGORY_ID = type.ID ISSUE_PROJECT_CATEGORY_DICT c1
AND type.CUSTOMER_ID = #{customerId} INNER JOIN ISSUE_PROJECT_CATEGORY_DICT c2 ON c1.PID = c2.ID
WHERE WHERE
tag.DEL_FLAG = '0' c1.CATEGORY_TYPE = '2'
AND tag.CUSTOMER_ID = #{customerId} AND c1.CUSTOMER_ID = #{customerId}
<if test='null != isDefault and "" != isDefault'> AND c1.IS_DISABLE = 'enable'
AND tag.IS_DEFAULT = #{isDefault} AND c2.CUSTOMER_ID = #{customerId}
</if> ) type ON tag.CATEGORY_ID = type.ID
<choose> WHERE
<when test="null != categories and categories.size > 0"> tag.DEL_FLAG = '0'
<foreach collection="categories" item="id" open="AND ( tag.CATEGORY_ID IS NULL OR tag.CATEGORY_ID = '' OR " separator=" OR " close=" )"> AND tag.CUSTOMER_ID = #{customerId}
tag.CATEGORY_ID = #{id} AND tag.IS_DISABLE = 'enable'
</foreach> AND tag.IS_DEFAULT = '0'
ORDER BY FIELD( <choose>
tag.CATEGORY_ID, <when test="null != categories and categories.size > 0">
<foreach collection="categories" item="id" separator=" , "> <foreach collection="categories" item="id" open="AND ( " separator=" OR " close=" )">
#{id} tag.CATEGORY_ID = #{id}
</foreach> </foreach>
) ORDER BY FIELD(
</when> tag.CATEGORY_ID,
<otherwise> <foreach collection="categories" item="id" separator=" , ">
ORDER BY type.SORT #{id}
</otherwise> </foreach>
</choose> )
, CONVERT ( tag.TAG_NAME USING gbk ) </when>
<otherwise>
ORDER BY
type.pSort,
type.SORT ASC
</otherwise>
</choose>
,CONVERT ( tag.TAG_NAME USING gbk )
</select> </select>
<!-- 根据客户Id和标签Id集合查询标签的基础信息(标签名、标签码,标签所属分类) --> <!-- 根据客户Id和标签Id集合查询标签的基础信息(标签名、标签码,标签所属分类) -->

Loading…
Cancel
Save