!59 2022-1-20 Carl

Merge pull request !59 from Admin/sit-Carl-V3
This commit is contained in:
Admin 2022-01-20 10:55:59 +00:00 committed by Gitee
commit 2741a41024
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 24 additions and 20 deletions

View File

@ -70,30 +70,30 @@ public class GoodController {
List<String> brandNameList = new ArrayList<>(); List<String> brandNameList = new ArrayList<>();
List<String> tagNameList = new ArrayList<>(); List<String> tagNameList = new ArrayList<>();
int count = 0; int count = 0;
String categoryName = "";
for (String categoryKey : paramMap.keySet()) { for (String categoryKey : paramMap.keySet()) {
if(categoryKey == "categoryName" || categoryKey == "tagFunction" || categoryKey == "tagUsedAge" || categoryKey == "tagBreed") { if(categoryKey == "categoryName" || categoryKey == "tagFunction" || categoryKey == "tagUsedAge" || categoryKey == "tagBreed" || categoryKey == "tagStatus") {
switch (categoryKey) { switch (categoryKey) {
case "categoryName": case "categoryName":
categoryName = "专区"; brandNameList.add("专区");
break; break;
case "tagFunction": case "tagFunction":
categoryName = "功能"; brandNameList.add("功能");
break; break;
case "tagUsedAge": case "tagUsedAge":
categoryName = "年龄"; brandNameList.add("年龄");
break; break;
case "tagBreed": case "tagBreed":
categoryName = "品种"; brandNameList.add("品种");
break; break;
} }
brandNameList.add(categoryName);
count++; count++;
for (String tagName : paramMap.get(categoryKey).split(",")) { for (String tagName : paramMap.get(categoryKey).split(",")) {
if (categoryKey != "tagStatus") {
tagNameList.add(tagName); tagNameList.add(tagName);
} }
} }
} }
}
if(count > 0) { 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<>();
@ -103,16 +103,21 @@ 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(brandNameList.size() == 0 && productQueryEntity.getTagStatus() != null && productQueryEntity.getTagStatus() != "") {
if (productQueryEntity.getTagStatus().equals("1") || productQueryEntity.getTagStatus().equals("0")) {
productQueryEntity.setCount("4");
}else{
productQueryEntity.setCount("1"); productQueryEntity.setCount("1");
}else{
if (productQueryEntity.getTagStatus() != null && productQueryEntity.getTagStatus() != "" && brandNameList.size() != 0) {
if(productQueryEntity.getCategoryName() != "" &&productQueryEntity.getCategoryName() != null) {
productQueryEntity.setCount(StringUtil.toString(count -1));
}else{
productQueryEntity.setCount(StringUtil.toString(count));
} }
}else{ }else{
productQueryEntity.setCount(StringUtil.toString(count)); productQueryEntity.setCount(StringUtil.toString(count));
} }
}
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();

View File

@ -40,7 +40,6 @@ 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("categoryName"); paramMap.remove("categoryName");
paramMap.remove("tagUsedAge"); paramMap.remove("tagUsedAge");
paramMap.remove("tagFunction"); paramMap.remove("tagFunction");

View File

@ -8,9 +8,6 @@
<select id="findAllByCondition" resultMap="ProductSearchTagEntity"> <select id="findAllByCondition" resultMap="ProductSearchTagEntity">
select tag_code,brand_name,tag_name from t_royalcanin_productsearchtag WHERE select tag_code,brand_name,tag_name from t_royalcanin_productsearchtag WHERE
is_delete = 0 is_delete = 0
<if test="petType != null and petType != ''">
AND pet_type = #{petType}
</if>
<if test="brandNameList != null and brandNameList.size > 0"> <if test="brandNameList != null and brandNameList.size > 0">
AND brand_name in AND brand_name in
<foreach collection="brandNameList" open="(" close=")" separator="," item="brandName"> <foreach collection="brandNameList" open="(" close=")" separator="," item="brandName">
@ -25,10 +22,13 @@
</foreach> </foreach>
</if> </if>
<if test="tagStatus != null and tagStatus == 1"> <if test="tagStatus != null and tagStatus == 1">
AND tag_name not like '%湿粮%' or brand_name in ( '专区' ) and tag_name not like '%湿粮%'
</if> </if>
<if test="tagStatus != null and tagStatus == 2"> <if test="tagStatus != null and tagStatus == 2">
AND tag_name like '%湿粮%' or brand_name in ( '专区' ) and tag_name like '%湿粮%'
</if>
<if test="petType != null and petType != ''">
AND pet_type = #{petType}
</if> </if>
</select> </select>
</mapper> </mapper>