将 onemall 老代码,统一到归档目录,后续不断迁移移除
This commit is contained in:
36
归档/search-service-project/search-service-api/pom.xml
Normal file
36
归档/search-service-project/search-service-api/pom.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>search-service-project</artifactId>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>search-service-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>common-framework</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign-core</artifactId>
|
||||
<version>RELEASE</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 占位,避免包折叠
|
||||
*/
|
||||
package cn.iocoder.mall.searchservice.enums;
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.mall.searchservice.enums.product;
|
||||
|
||||
/**
|
||||
* 搜索商品条件的字段枚举
|
||||
*/
|
||||
public enum SearchProductConditionFieldEnum {
|
||||
|
||||
CATEGORY("category");
|
||||
|
||||
/**
|
||||
* 字段
|
||||
*/
|
||||
private final String field;
|
||||
|
||||
SearchProductConditionFieldEnum(String field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public String getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.mall.searchservice.enums.product;
|
||||
|
||||
/**
|
||||
* 搜索商品分页查询的排序字段枚举
|
||||
*/
|
||||
public enum SearchProductPageQuerySortFieldEnum {
|
||||
|
||||
/**
|
||||
* 购买价格
|
||||
*/
|
||||
BUY_PRICE("buyPrice");
|
||||
|
||||
/**
|
||||
* 字段
|
||||
*/
|
||||
private final String field;
|
||||
|
||||
SearchProductPageQuerySortFieldEnum(String field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public String getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public static boolean contains(String field) {
|
||||
for (SearchProductPageQuerySortFieldEnum fieldEnum : values()) {
|
||||
if (field.equals(fieldEnum.getField())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 占位,避免包折叠
|
||||
*/
|
||||
package cn.iocoder.mall.searchservice.rpc;
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.iocoder.mall.searchservice.rpc.product;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.searchservice.rpc.product.dto.SearchProductConditionReqDTO;
|
||||
import cn.iocoder.mall.searchservice.rpc.product.dto.SearchProductConditionRespDTO;
|
||||
import cn.iocoder.mall.searchservice.rpc.product.dto.SearchProductPageReqDTO;
|
||||
import cn.iocoder.mall.searchservice.rpc.product.dto.SearchProductRespDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* Title:
|
||||
* Description:
|
||||
*
|
||||
* @author zhuyang
|
||||
* @version 1.0 2021/10/9
|
||||
*/
|
||||
@FeignClient(value = "search-service")
|
||||
public interface SearchProductFeign {
|
||||
/**
|
||||
* 获得商品搜索分页
|
||||
*
|
||||
* @param pageReqDTO 分页请求 DTO
|
||||
* @return 商品搜索分页结果
|
||||
*/
|
||||
@PostMapping("/search/product//pageSearchProduct")
|
||||
CommonResult<PageResult<SearchProductRespDTO>> pageSearchProduct(@RequestBody SearchProductPageReqDTO pageReqDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 获得商品搜索条件
|
||||
*
|
||||
* @param conditionReqDTO 搜索条件 DTO
|
||||
* @return 搜索条件
|
||||
*/
|
||||
@PostMapping("/search/product/getSearchProductCondition")
|
||||
CommonResult<SearchProductConditionRespDTO> getSearchProductCondition(@RequestBody SearchProductConditionReqDTO conditionReqDTO);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.mall.searchservice.rpc.product.dto;
|
||||
|
||||
import cn.iocoder.mall.searchservice.enums.product.SearchProductConditionFieldEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 商品搜索条件 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SearchProductConditionReqDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyword;
|
||||
/**
|
||||
* 需要返回的搜索条件
|
||||
*
|
||||
* 可选择的条件,见 {@link SearchProductConditionFieldEnum} 枚举类
|
||||
*/
|
||||
private Collection<String> fields;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.mall.searchservice.rpc.product.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品搜索条件 Response DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SearchProductConditionRespDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 商品分类数组
|
||||
*/
|
||||
private List<Integer> cids;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.mall.searchservice.rpc.product.dto;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import cn.iocoder.common.framework.vo.SortingField;
|
||||
import cn.iocoder.mall.searchservice.enums.product.SearchProductPageQuerySortFieldEnum;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品检索分页查询 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class SearchProductPageReqDTO extends PageParam {
|
||||
|
||||
/**
|
||||
* 分类编号
|
||||
*/
|
||||
private Integer cid;
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyword;
|
||||
/**
|
||||
* 排序字段数组
|
||||
*
|
||||
* 可支持排序的字段,见 {@link SearchProductPageQuerySortFieldEnum}
|
||||
*/
|
||||
private List<SortingField> sorts;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package cn.iocoder.mall.searchservice.rpc.product.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 搜索商品 Response DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SearchProductRespDTO implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
// ========== 基本信息 =========
|
||||
/**
|
||||
* SPU 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 卖点
|
||||
*/
|
||||
private String sellPoint;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 分类编号
|
||||
*/
|
||||
private Integer cid;
|
||||
/**
|
||||
* 分类名
|
||||
*/
|
||||
private String categoryName;
|
||||
/**
|
||||
* 商品主图地数组
|
||||
*/
|
||||
private List<String> picUrls;
|
||||
|
||||
// ========== 其他信息 =========
|
||||
/**
|
||||
* 是否上架商品(是否可见)。
|
||||
*
|
||||
* true 为已上架
|
||||
* false 为已下架
|
||||
*/
|
||||
private Boolean visible;
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
// ========== Sku 相关字段 =========
|
||||
/**
|
||||
* 原价格,单位:分
|
||||
*/
|
||||
private Integer originalPrice;
|
||||
/**
|
||||
* 购买价格,单位:分。
|
||||
*/
|
||||
private Integer buyPrice;
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
// ========== 促销活动相关字段 =========
|
||||
// 目前只促销单体商品促销,目前仅限制折扣。
|
||||
/**
|
||||
* 促销活动编号
|
||||
*/
|
||||
private Integer promotionActivityId;
|
||||
/**
|
||||
* 促销活动标题
|
||||
*/
|
||||
private String promotionActivityTitle;
|
||||
/**
|
||||
* 促销活动类型
|
||||
*/
|
||||
private Integer promotionActivityType;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user