parent
5acf1ae3d4
commit
f3316d14c7
@ -1,20 +0,0 @@
|
|||||||
package cn.iocoder.mall.product.application.vo.users;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@ApiModel("商品 SPU 分页 VO")
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class UsersProductSpuPageVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "spu 数组", required = true)
|
|
||||||
private List<UsersProductSpuVO> spus;
|
|
||||||
@ApiModelProperty(value = "总数", required = true)
|
|
||||||
private Integer count;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,7 +1,15 @@
|
|||||||
package cn.iocoder.mall.searchservice.rpc.product;
|
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.SearchProductPageReqDTO;
|
||||||
|
import cn.iocoder.mall.searchservice.rpc.product.dto.SearchProductRespDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品搜索 RPC 接口
|
* 商品搜索 RPC 接口
|
||||||
*/
|
*/
|
||||||
public interface SearchProductRpc {
|
public interface SearchProductRpc {
|
||||||
|
|
||||||
|
CommonResult<PageResult<SearchProductRespDTO>> pageSearchProduct(SearchProductPageReqDTO pageQueryReqDTO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,24 @@
|
|||||||
package cn.iocoder.mall.searchservice.rpc.product;
|
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.manager.product.SearchProductManager;
|
||||||
|
import cn.iocoder.mall.searchservice.rpc.product.dto.SearchProductPageReqDTO;
|
||||||
|
import cn.iocoder.mall.searchservice.rpc.product.dto.SearchProductRespDTO;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||||
|
|
||||||
@DubboService
|
@DubboService
|
||||||
public class SearchProductRpcImpl implements SearchProductRpc {
|
public class SearchProductRpcImpl implements SearchProductRpc {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SearchProductManager searchProductManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<PageResult<SearchProductRespDTO>> pageSearchProduct(SearchProductPageReqDTO pageQueryReqDTO) {
|
||||||
|
return success(searchProductManager.pageSearchProduct(pageQueryReqDTO));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +0,0 @@
|
|||||||
package cn.iocoder.mall.search.biz.api.user;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
|
||||||
|
|
||||||
public interface ProductSearchRPC {
|
|
||||||
|
|
||||||
CommonResult<Integer> rebuild();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建商品的搜索索引
|
|
||||||
*
|
|
||||||
* @param id 商品编号
|
|
||||||
* @return 构建结果
|
|
||||||
*/
|
|
||||||
CommonResult<Boolean> save(Integer id);
|
|
||||||
|
|
||||||
// ProductPageBO getSearchPage(ProductSearchPageDTO searchPageDTO);
|
|
||||||
//
|
|
||||||
// ProductConditionBO getSearchCondition(ProductConditionDTO conditionDTO);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
package cn.iocoder.mall.search.biz.response.user;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class ProductPageResponse implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 管理员数组
|
|
||||||
*/
|
|
||||||
private List<ProductResponse> list;
|
|
||||||
/**
|
|
||||||
* 总量
|
|
||||||
*/
|
|
||||||
private Integer total;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
### /user-address/get-default 成功
|
### /user-address/get-default 成功
|
||||||
GET {{user-api-base-url}}/product-category/list?pid=0
|
GET {{shop-api-base-url}}/product-category/list?pid=0
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|||||||
@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.mall.shopweb.controller.product;
|
||||||
|
|
||||||
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
|
import cn.iocoder.common.framework.vo.PageResult;
|
||||||
|
import cn.iocoder.mall.shopweb.controller.product.vo.product.ProductSpuPageReqVO;
|
||||||
|
import cn.iocoder.mall.shopweb.controller.product.vo.product.ProductSpuRespVO;
|
||||||
|
import cn.iocoder.mall.shopweb.manager.product.ProductSpuManager;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||||
|
|
||||||
|
@Api(tags = "商品 SPU API")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/product-spu")
|
||||||
|
@Validated
|
||||||
|
public class ProductSpuController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProductSpuManager productSpuManager;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("获得商品 SPU 的分页")
|
||||||
|
public CommonResult<PageResult<ProductSpuRespVO>> pageProductSpu(ProductSpuPageReqVO pageReqVO) {
|
||||||
|
return success(productSpuManager.pageProductSpu(pageReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.iocoder.mall.shopweb.controller.product.vo;
|
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package cn.iocoder.mall.shopweb.controller.product.vo.product;
|
||||||
|
|
||||||
|
import cn.iocoder.common.framework.vo.PageParam;
|
||||||
|
import cn.iocoder.common.framework.vo.SortingField;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ProductSpuPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类编号
|
||||||
|
*/
|
||||||
|
private Integer cid;
|
||||||
|
/**
|
||||||
|
* 关键字
|
||||||
|
*/
|
||||||
|
private String keyword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序字段数组
|
||||||
|
*/
|
||||||
|
private List<SortingField> sorts;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package cn.iocoder.mall.shopweb.convert.product;
|
||||||
|
|
||||||
|
import cn.iocoder.common.framework.vo.PageResult;
|
||||||
|
import cn.iocoder.mall.searchservice.rpc.product.dto.SearchProductPageReqDTO;
|
||||||
|
import cn.iocoder.mall.searchservice.rpc.product.dto.SearchProductRespDTO;
|
||||||
|
import cn.iocoder.mall.shopweb.controller.product.vo.product.ProductSpuPageReqVO;
|
||||||
|
import cn.iocoder.mall.shopweb.controller.product.vo.product.ProductSpuRespVO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ProductSpuConvert {
|
||||||
|
|
||||||
|
ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class);
|
||||||
|
|
||||||
|
SearchProductPageReqDTO convert(ProductSpuPageReqVO bean);
|
||||||
|
|
||||||
|
PageResult<ProductSpuRespVO> convertPage(PageResult<SearchProductRespDTO> page);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.mall.shopweb.manager.product;
|
||||||
|
|
||||||
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
|
import cn.iocoder.common.framework.vo.PageResult;
|
||||||
|
import cn.iocoder.mall.searchservice.rpc.product.SearchProductRpc;
|
||||||
|
import cn.iocoder.mall.searchservice.rpc.product.dto.SearchProductRespDTO;
|
||||||
|
import cn.iocoder.mall.shopweb.controller.product.vo.product.ProductSpuPageReqVO;
|
||||||
|
import cn.iocoder.mall.shopweb.controller.product.vo.product.ProductSpuRespVO;
|
||||||
|
import cn.iocoder.mall.shopweb.convert.product.ProductSpuConvert;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Product SPU Manager
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class ProductSpuManager {
|
||||||
|
|
||||||
|
@DubboReference(version = "${dubbo.consumer.SearchProductRpc.version}")
|
||||||
|
private SearchProductRpc searchProductRpc;
|
||||||
|
|
||||||
|
public PageResult<ProductSpuRespVO> pageProductSpu(ProductSpuPageReqVO pageReqVO) {
|
||||||
|
CommonResult<PageResult<SearchProductRespDTO>> pageResult =
|
||||||
|
searchProductRpc.pageSearchProduct(ProductSpuConvert.INSTANCE.convert(pageReqVO));
|
||||||
|
pageResult.checkError();
|
||||||
|
return ProductSpuConvert.INSTANCE.convertPage(pageResult.getData());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue