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

View File

@ -40,11 +40,12 @@ public class GoodService {
public String brandQuery(ProductQueryEntity productQueryEntity) throws Exception { public String brandQuery(ProductQueryEntity productQueryEntity) throws Exception {
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(productQueryEntity); Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(productQueryEntity);
paramMap.remove("petType"); // paramMap.remove("petType");
paramMap.remove("categoryName"); paramMap.remove("categoryName");
paramMap.remove("tagUsedAge"); paramMap.remove("tagUsedAge");
paramMap.remove("tagFunction"); paramMap.remove("tagFunction");
paramMap.remove("tagBreed"); paramMap.remove("tagBreed");
paramMap.remove("tagStatus");
MapRemoveNullUtil.removeNullEntry(paramMap); MapRemoveNullUtil.removeNullEntry(paramMap);
paramMap.put("secret","H5@2021"); paramMap.put("secret","H5@2021");
paramMap.put("channelId","15"); 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} #{tagName}
</foreach> </foreach>
</if> </if>
<if test="tagStatus != null and tagStatus == '1'"> <if test="tagStatus != null and tagStatus == 1">
OR tagName not like '%湿粮%' AND tag_name not like '%湿粮%'
</if> </if>
<if test="tagStatus != null and tagStatus == '2'"> <if test="tagStatus != null and tagStatus == 2">
OR tagName like '%湿粮%' AND tag_name like '%湿粮%'
</if> </if>
</select> </select>
</mapper> </mapper>