mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-03 02:36:39 +08:00
adding productsearchTag select
This commit is contained in:
parent
248fd9cc5b
commit
3cde853f9e
@ -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);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.Dao.ProductSearchTagDao">
|
||||
<resultMap id="ProductSearchTagEntity"
|
||||
type="net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.model.ProductSearchTagEntity"></resultMap>
|
||||
|
||||
|
||||
<select id="findAllByCondition" resultMap="ProductSearchTagEntity">
|
||||
select tag_code,brand_name,tag_name from t_royalcanin_productsearchtag WHERE
|
||||
is_delete = 0
|
||||
<if test="petType != null and petType != ''">
|
||||
AND pet_type = #{petType}
|
||||
</if>
|
||||
<if test="brandNameList != null and brandNameList.size > 0">
|
||||
AND brand_name in
|
||||
<foreach collection="brandNameList" open="(" close=")" separator="," item="brandName">
|
||||
#{brandName}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="tagNameList != null and tagNameList.size > 0">
|
||||
AND tag_name in
|
||||
<foreach collection="tagNameList" open="(" close=")" separator="," item="tagName">
|
||||
#{tagName}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="tagStatus != null and tagStatus == '1'">
|
||||
OR tagName not like '%湿粮%'
|
||||
</if>
|
||||
<if test="tagStatus != null and tagStatus == '2'">
|
||||
OR tagName like '%湿粮%'
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
@ -1757,18 +1757,18 @@ INSERT INTO `t_royalcanin_productsearchtag` (`id`, `brand_code`, `brand_name`, `
|
||||
(1050, '16518816', '功能', '0', '体重呵护', '1019', '1019010', 0, '2022-01-19 16:41:55'),
|
||||
(1059, '16518816', '年龄', '0', '<4月龄', '1018', '1018007', 0, '2022-01-19 16:41:55'),
|
||||
(1060, '16518816', '年龄', '1', '离乳期', '1018', '1018008', 0, '2022-01-19 16:41:55'),
|
||||
(1062, '16518816', '体型犬粮', '1', '体型犬粮', '1021', '1021001', 0, '2022-01-19 16:41:55'),
|
||||
(1063, '16518816', '功能犬粮', '1', '功能犬粮', '1021', '1021002', 0, '2022-01-19 16:41:55'),
|
||||
(1064, '16518816', '品种犬粮', '1', '品种犬粮', '1021', '1021003', 0, '2022-01-19 16:41:55'),
|
||||
(1065, '16518816', '犬湿粮', '1', '犬湿粮', '1021', '1021004', 0, '2022-01-19 16:41:55'),
|
||||
(1066, '16518816', '功能猫粮', '0', '功能猫粮', '1021', '1021005', 0, '2022-01-19 16:41:55'),
|
||||
(1067, '16518816', '品种猫粮', '0', '品种猫粮', '1021', '1021006', 0, '2022-01-19 16:41:55'),
|
||||
(1068, '16518816', '营养猫粮', '0', '营养猫粮', '1021', '1021007', 0, '2022-01-19 16:41:55'),
|
||||
(1062, '16518816', '专区', '1', '体型犬粮', '1021', '1021001', 0, '2022-01-19 16:41:55'),
|
||||
(1063, '16518816', '专区', '1', '功能犬粮', '1021', '1021002', 0, '2022-01-19 16:41:55'),
|
||||
(1064, '16518816', '专区', '1', '品种犬粮', '1021', '1021003', 0, '2022-01-19 16:41:55'),
|
||||
(1065, '16518816', '专区', '1', '犬湿粮', '1021', '1021004', 0, '2022-01-19 16:41:55'),
|
||||
(1066, '16518816', '专区', '0', '功能猫粮', '1021', '1021005', 0, '2022-01-19 16:41:55'),
|
||||
(1067, '16518816', '专区', '0', '品种猫粮', '1021', '1021006', 0, '2022-01-19 16:41:55'),
|
||||
(1068, '16518816', '专区', '0', '营养猫粮', '1021', '1021007', 0, '2022-01-19 16:41:55'),
|
||||
(1069, '16518816', '功能', '0', '消化优选', '1019', '1019011', 0, '2022-01-19 16:41:55'),
|
||||
(1070, '16518816', '品种', '0', '波斯', '1017', '1017017', 0, '2022-01-19 16:41:55'),
|
||||
(1071, '16518816', '品种', '0', '孟加拉豹猫', '1017', '1017018', 0, '2022-01-19 16:41:55'),
|
||||
(1073, '16518816', '品种', '0', '斯芬克斯', '1017', '1017020', 0, '2022-01-19 16:41:55'),
|
||||
(1083, '16518816', '猫湿粮', '0', '猫湿粮', '1021', '1021111', 0, '2022-01-19 16:41:55'),
|
||||
(1083, '16518816', '专区', '0', '猫湿粮', '1021', '1021111', 0, '2022-01-19 16:41:55'),
|
||||
(1084, '16518816', '品种', '1', '博美', '1017', '1017021', 0, '2022-01-19 16:41:55'),
|
||||
(1086, '16518816', '优卡产品', '1', '优卡产品', '1021', '1021050', 0, '2022-01-19 16:41:55');
|
||||
(1086, '16518816', '专区', '1', '优卡产品', '1021', '1021050', 0, '2022-01-19 16:41:55');
|
||||
--
|
Loading…
Reference in New Issue
Block a user