进行商品添加的迁移
This commit is contained in:
@@ -3,5 +3,21 @@ GET {{baseUrl}}/product-spu/page?pageNo=1&pageSize=10
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
###
|
||||
### /product-spu/page 成功(有库存 + 上架)
|
||||
GET {{baseUrl}}/product-spu/page?pageNo=1&pageSize=10&hasQuantity=true&visible=true
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
### /product-spu/page 成功(无库存 + 下架)
|
||||
GET {{baseUrl}}/product-spu/page?pageNo=1&pageSize=10&hasQuantity=false&visible=false
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
### /product-spu/create 成功
|
||||
POST {{baseUrl}}/product-spu/create
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
name=测试商品标题&description=测试商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3
|
||||
|
||||
###
|
||||
|
||||
@@ -61,6 +61,9 @@ public class ProductSpuController {
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得商品 SPU 分页")
|
||||
public CommonResult<PageResult<ProductSpuRespVO>> pageProductSpu(ProductSpuPageReqVO pageVO) {
|
||||
//
|
||||
//
|
||||
//
|
||||
return success(productSpuManager.pageProductSpu(pageVO));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,45 @@ package cn.iocoder.mall.managementweb.controller.product.vo.spu;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("商品 SPU创建 Request VO")
|
||||
@ApiModel("商品 SPU 创建 Request VO")
|
||||
@Data
|
||||
public class ProductSpuCreateReqVO {
|
||||
|
||||
/**
|
||||
* SKU 信息
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Sku {
|
||||
|
||||
/**
|
||||
* 规格值数组
|
||||
*/
|
||||
@NotNull(message = "规格值数组不能为空")
|
||||
private List<Integer> attrValueIds;
|
||||
/**
|
||||
* 价格,单位:分
|
||||
*/
|
||||
@NotNull(message = "价格不能为空")
|
||||
@Min(value = 1L, message = "最小价格为 1")
|
||||
private Integer price;
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
@NotNull(message = "库存数量不能为空")
|
||||
@Min(value = 1L, message = "最小库存为 1")
|
||||
private Integer quantity;
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(value = "SPU 名字", required = true)
|
||||
@NotEmpty(message = "SPU 名字不能为空")
|
||||
private String name;
|
||||
@@ -30,14 +60,14 @@ public class ProductSpuCreateReqVO {
|
||||
@ApiModelProperty(value = "是否上架商品", required = true)
|
||||
@NotNull(message = "是否上架商品不能为空")
|
||||
private Boolean visible;
|
||||
@ApiModelProperty(value = "排序字段", required = true)
|
||||
@NotNull(message = "排序字段不能为空")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "价格", required = true)
|
||||
@NotNull(message = "价格不能为空")
|
||||
private Integer price;
|
||||
@ApiModelProperty(value = "库存数量", required = true)
|
||||
@NotNull(message = "库存数量不能为空")
|
||||
private Integer quantity;
|
||||
|
||||
// ========== SKU =========
|
||||
|
||||
/**
|
||||
* SKU 数组
|
||||
*/
|
||||
@NotNull(message = "SKU 不能为空")
|
||||
@Valid
|
||||
private List<Sku> skus;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,23 +11,13 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ProductSpuPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "SPU 名字", required = true)
|
||||
@ApiModelProperty(value = "SPU 名字", notes = "模糊匹配", example = "艿艿")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "卖点", required = true)
|
||||
private String sellPoint;
|
||||
@ApiModelProperty(value = "描述", required = true)
|
||||
private String description;
|
||||
@ApiModelProperty(value = "分类编号", required = true)
|
||||
@ApiModelProperty(value = "分类编号", example = "1024")
|
||||
private Integer cid;
|
||||
@ApiModelProperty(value = "商品主图地址", required = true)
|
||||
private String picUrls;
|
||||
@ApiModelProperty(value = "是否上架商品", required = true)
|
||||
private Integer visible;
|
||||
@ApiModelProperty(value = "排序字段", required = true)
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "价格", required = true)
|
||||
private Integer price;
|
||||
@ApiModelProperty(value = "库存数量", required = true)
|
||||
private Integer quantity;
|
||||
@ApiModelProperty(value = "是否上架商品", example = "true")
|
||||
private Boolean visible;
|
||||
@ApiModelProperty(value = "是否有库存", example = "true")
|
||||
private Boolean hasQuantity;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuCreateR
|
||||
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuPageReqVO;
|
||||
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuRespVO;
|
||||
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuUpdateReqVO;
|
||||
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuCreateReqDTO;
|
||||
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuAndSkuCreateReqDTO;
|
||||
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuPageReqDTO;
|
||||
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO;
|
||||
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuUpdateReqDTO;
|
||||
@@ -19,7 +19,7 @@ public interface ProductSpuConvert {
|
||||
|
||||
ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class);
|
||||
|
||||
ProductSpuCreateReqDTO convert(ProductSpuCreateReqVO bean);
|
||||
ProductSpuAndSkuCreateReqDTO convert(ProductSpuCreateReqVO bean);
|
||||
|
||||
ProductSpuUpdateReqDTO convert(ProductSpuUpdateReqVO bean);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user