mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-22 18:36:52 +08:00
adding productsearchTag select
This commit is contained in:
@@ -69,29 +69,37 @@ public class GoodController {
|
||||
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(productQueryEntity);
|
||||
List<String> brandNameList = new ArrayList<>();
|
||||
List<String> tagNameList = new ArrayList<>();
|
||||
for (String key : paramMap.keySet()) {
|
||||
if(key == "categoryName" ){
|
||||
for(String categoryname : paramMap.get(key).split(",")){
|
||||
if(categoryname.equals("体型犬粮")||categoryname.equals("功能犬粮")||categoryname.equals("品种犬粮")||categoryname.equals("犬湿粮")||categoryname.equals("功能猫粮")||categoryname.equals("品种猫粮")||categoryname.equals("营养猫粮")||categoryname.equals("猫湿粮")||categoryname.equals("优卡产品")) {
|
||||
brandNameList.add(categoryname);
|
||||
tagNameList.add(categoryname);
|
||||
}else {
|
||||
brandNameList.add(categoryname);
|
||||
}
|
||||
}
|
||||
}else if (key == "tagUsedAge"||key == "tagFunction"||key == "tagBreed"){
|
||||
for(String tagName : paramMap.get(key).split(",")){
|
||||
tagNameList.add(tagName);
|
||||
}
|
||||
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;
|
||||
}
|
||||
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());
|
||||
}
|
||||
String tagCode = String.join(",",tagCodeList);
|
||||
productQueryEntity.setTagCode(tagCode);
|
||||
productQueryEntity.setTags(tagCode);
|
||||
productQueryEntity.setCount(StringUtil.toString(count));
|
||||
long startTime = System.currentTimeMillis();
|
||||
String result = goodService.brandQuery(productQueryEntity);
|
||||
long acceptTime = System.currentTimeMillis() ;
|
||||
|
||||
@@ -37,8 +37,10 @@ public class ProductQueryEntity {
|
||||
|
||||
private String tagStatus;
|
||||
|
||||
private String tagCode;
|
||||
private String tags;
|
||||
|
||||
private String isSales;
|
||||
|
||||
private String count;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.Dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.model.ProductSearchTagEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Component
|
||||
public interface ProductSearchTagDao extends BaseMapper<ProductSearchTagEntity> {
|
||||
|
||||
List<ProductSearchTagEntity> findAllByCondition(@Param("brandNameList") List<String> brandNameList,@Param("petType")String petType,@Param("tagNameList") List<String> tagNameList,@Param("tagStatus")String tagStatus);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("t_royalcanin_productSearchTag")
|
||||
public class ProductSearchTagEntity {
|
||||
|
||||
private String id ;
|
||||
|
||||
private String brandCode;
|
||||
|
||||
private String brandName;
|
||||
|
||||
private String petType;
|
||||
|
||||
private String tagName;
|
||||
|
||||
private String tagType;
|
||||
|
||||
private String tagCode;
|
||||
|
||||
private String isDelete;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.service;
|
||||
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.Dao.ProductSearchTagDao;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.model.ProductSearchTagEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ProductSearchTagService {
|
||||
|
||||
@Autowired
|
||||
private ProductSearchTagDao productSearchTagDao;
|
||||
|
||||
|
||||
public List<ProductSearchTagEntity> findAllByCondition( List<String> brandNameList,String petType,List<String> tagNameList,String tagStatus){
|
||||
return productSearchTagDao.findAllByCondition(brandNameList,petType,tagNameList,tagStatus);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user