后端:增加商品修改时,发送 MQ 消息
后端:增加搜索服务,监听 MQ 消息,建立商品索引
This commit is contained in:
@@ -1,13 +1,25 @@
|
||||
package cn.iocoder.mall.search.api;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.search.api.bo.ESProductPageBO;
|
||||
import cn.iocoder.mall.search.api.bo.ProductConditionBO;
|
||||
import cn.iocoder.mall.search.api.bo.ProductPageBO;
|
||||
import cn.iocoder.mall.search.api.dto.ProductConditionDTO;
|
||||
import cn.iocoder.mall.search.api.dto.ProductSearchPageDTO;
|
||||
|
||||
public interface ProductSearchService {
|
||||
|
||||
CommonResult<Integer> rebuild();
|
||||
|
||||
CommonResult<ESProductPageBO> searchPage(ProductSearchPageDTO searchPageDTO);
|
||||
/**
|
||||
* 构建商品的搜索索引
|
||||
*
|
||||
* @param id 商品编号
|
||||
* @return 构建结果
|
||||
*/
|
||||
CommonResult<Boolean> save(Integer id);
|
||||
|
||||
CommonResult<ProductPageBO> getSearchPage(ProductSearchPageDTO searchPageDTO);
|
||||
|
||||
CommonResult<ProductConditionBO> getSearchCondition(ProductConditionDTO conditionDTO);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ESProductBO implements Serializable {
|
||||
public class ProductBO implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.mall.search.api.bo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品搜索条件返回 BO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductConditionBO {
|
||||
|
||||
/**
|
||||
* 商品分类数组
|
||||
*/
|
||||
private List<Category> categories;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Category {
|
||||
|
||||
/**
|
||||
* 分类编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,12 +8,12 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ESProductPageBO implements Serializable {
|
||||
public class ProductPageBO implements Serializable {
|
||||
|
||||
/**
|
||||
* 管理员数组
|
||||
*/
|
||||
private List<ESProductBO> list;
|
||||
private List<ProductBO> list;
|
||||
/**
|
||||
* 总量
|
||||
*/
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.iocoder.mall.search.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 获得商品检索条件 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductConditionDTO {
|
||||
|
||||
/**
|
||||
* Field - 商品分类
|
||||
*/
|
||||
public static final String FIELD_CATEGORY = "category";
|
||||
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyword;
|
||||
/**
|
||||
* 需要返回的搜索条件的 fields 名
|
||||
*/
|
||||
private Collection<String> fields;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user