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,6 +72,7 @@ public class GoodController {
int count = 0; int count = 0;
String categoryName = ""; String categoryName = "";
for (String categoryKey : paramMap.keySet()) { for (String categoryKey : paramMap.keySet()) {
if(categoryKey == "categoryName" || categoryKey == "tagFunction" || categoryKey == "tagUsedAge" || categoryKey == "tagBreed") {
switch (categoryKey) { switch (categoryKey) {
case "categoryName": case "categoryName":
categoryName = "专区"; categoryName = "专区";
@ -92,6 +93,8 @@ public class GoodController {
tagNameList.add(tagName); tagNameList.add(tagName);
} }
} }
}
if(count > 0) {
List<ProductSearchTagEntity> productSearchTagList = productSearchTagService.findAllByCondition(brandNameList, productQueryEntity.getPetType(), tagNameList, productQueryEntity.getTagStatus()); List<ProductSearchTagEntity> productSearchTagList = productSearchTagService.findAllByCondition(brandNameList, productQueryEntity.getPetType(), tagNameList, productQueryEntity.getTagStatus());
List<String> tagCodeList = new ArrayList<>(); List<String> tagCodeList = new ArrayList<>();
for (ProductSearchTagEntity productSearchTagEntity : productSearchTagList) { for (ProductSearchTagEntity productSearchTagEntity : productSearchTagList) {
@ -99,7 +102,19 @@ public class GoodController {
} }
String tagCode = String.join(",", tagCodeList); String tagCode = String.join(",", tagCodeList);
productQueryEntity.setTags(tagCode); productQueryEntity.setTags(tagCode);
}
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)); 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>