adding productsearchTag select

This commit is contained in:
Carl 2022-01-20 17:09:59 +08:00
parent 3cde853f9e
commit 6060715361
4 changed files with 47 additions and 31 deletions

View File

@ -72,34 +72,49 @@ public class GoodController {
int count = 0;
String categoryName = "";
for (String categoryKey : paramMap.keySet()) {
switch (categoryKey) {
case "categoryName":
categoryName = "专区";
break;
case "tagFunction":
categoryName = "功能";
break;
case "tagUsedAge":
categoryName = "年龄";
break;
case "tagBreed":
categoryName = "品种";
break;
if(categoryKey == "categoryName" || categoryKey == "tagFunction" || categoryKey == "tagUsedAge" || categoryKey == "tagBreed") {
switch (categoryKey) {
case "categoryName":
categoryName = "专区";
break;
case "tagFunction":
categoryName = "功能";
break;
case "tagUsedAge":
categoryName = "年龄";
break;
case "tagBreed":
categoryName = "品种";
break;
}
brandNameList.add(categoryName);
count++;
for (String tagName : paramMap.get(categoryKey).split(",")) {
tagNameList.add(tagName);
}
}
brandNameList.add(categoryName);
count ++ ;
for(String tagName : paramMap.get(categoryKey).split(",")){
tagNameList.add(tagName);
}
}
List<ProductSearchTagEntity> productSearchTagList = productSearchTagService.findAllByCondition(brandNameList,productQueryEntity.getPetType(),tagNameList,productQueryEntity.getTagStatus());
List<String> tagCodeList = new ArrayList<>();
for (ProductSearchTagEntity productSearchTagEntity:productSearchTagList){
tagCodeList.add(productSearchTagEntity.getTagCode());
if(count > 0) {
List<ProductSearchTagEntity> productSearchTagList = productSearchTagService.findAllByCondition(brandNameList, productQueryEntity.getPetType(), tagNameList, productQueryEntity.getTagStatus());
List<String> tagCodeList = new ArrayList<>();
for (ProductSearchTagEntity productSearchTagEntity : productSearchTagList) {
tagCodeList.add(productSearchTagEntity.getTagCode());
}
String tagCode = String.join(",", tagCodeList);
productQueryEntity.setTags(tagCode);
}
String tagCode = String.join(",",tagCodeList);
productQueryEntity.setTags(tagCode);
productQueryEntity.setCount(StringUtil.toString(count));
if(productQueryEntity.getTagStatus() != null && productQueryEntity.getTagStatus() != "") {
if (productQueryEntity.getTagStatus().equals("1") || productQueryEntity.getTagStatus().equals("0")) {
productQueryEntity.setCount("4");
}else{
productQueryEntity.setCount("1");
}
}else{
productQueryEntity.setCount(StringUtil.toString(count));
}
long startTime = System.currentTimeMillis();
String result = goodService.brandQuery(productQueryEntity);
long acceptTime = System.currentTimeMillis() ;

View File

@ -40,11 +40,12 @@ public class GoodService {
public String brandQuery(ProductQueryEntity productQueryEntity) throws Exception {
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(productQueryEntity);
paramMap.remove("petType");
// paramMap.remove("petType");
paramMap.remove("categoryName");
paramMap.remove("tagUsedAge");
paramMap.remove("tagFunction");
paramMap.remove("tagBreed");
paramMap.remove("tagStatus");
MapRemoveNullUtil.removeNullEntry(paramMap);
paramMap.put("secret","H5@2021");
paramMap.put("channelId","15");

View File

@ -62,6 +62,6 @@ public class MemberAddressUpdateEntity {
/**
* 是否默认地址
*/
private boolean isDefault;
private String isDefault;
}

View File

@ -24,11 +24,11 @@
#{tagName}
</foreach>
</if>
<if test="tagStatus != null and tagStatus == '1'">
OR tagName not like '%湿粮%'
<if test="tagStatus != null and tagStatus == 1">
AND tag_name not like '%湿粮%'
</if>
<if test="tagStatus != null and tagStatus == '2'">
OR tagName like '%湿粮%'
<if test="tagStatus != null and tagStatus == 2">
AND tag_name like '%湿粮%'
</if>
</select>
</mapper>