进行商品修改的迁移
This commit is contained in:
@@ -18,6 +18,34 @@ 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
|
||||
name=测试商品标题&description=测试商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true
|
||||
&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3
|
||||
&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=2,4
|
||||
|
||||
### /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,0
|
||||
|
||||
### /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
|
||||
&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=1,2,4
|
||||
|
||||
### /product-spu/update 成功
|
||||
POST {{baseUrl}}/product-spu/update
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
id=59&name=测试商品标题&description=测试商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true
|
||||
&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3
|
||||
&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=2,4
|
||||
|
||||
###
|
||||
|
||||
@@ -46,14 +46,14 @@ public class ProductSpuController {
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得商品 SPU")
|
||||
@ApiImplicitParam(name = "productSpuId", value = "商品 SPU编号", required = true)
|
||||
@ApiImplicitParam(name = "productSpuId", value = "商品 SPU 编号", required = true)
|
||||
public CommonResult<ProductSpuRespVO> getProductSpu(@RequestParam("productSpuId") Integer productSpuId) {
|
||||
return success(productSpuManager.getProductSpu(productSpuId));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得商品 SPU 列表")
|
||||
@ApiImplicitParam(name = "productSpuIds", value = "商品 SPU编号列表", required = true)
|
||||
@ApiImplicitParam(name = "productSpuIds", value = "商品 SPU 编号列表", required = true)
|
||||
public CommonResult<List<ProductSpuRespVO>> listProductSpus(@RequestParam("productSpuIds") List<Integer> productSpuIds) {
|
||||
return success(productSpuManager.listProductSpus(productSpuIds));
|
||||
}
|
||||
|
||||
@@ -42,22 +42,22 @@ public class ProductSpuCreateReqVO {
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(value = "SPU 名字", required = true)
|
||||
@ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿")
|
||||
@NotEmpty(message = "SPU 名字不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "卖点", required = true)
|
||||
@ApiModelProperty(value = "卖点", required = true, example = "好吃好玩")
|
||||
@NotEmpty(message = "卖点不能为空")
|
||||
private String sellPoint;
|
||||
@ApiModelProperty(value = "描述", required = true)
|
||||
@ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈")
|
||||
@NotEmpty(message = "描述不能为空")
|
||||
private String description;
|
||||
@ApiModelProperty(value = "分类编号", required = true)
|
||||
@ApiModelProperty(value = "分类编号", required = true, example = "1")
|
||||
@NotNull(message = "分类编号不能为空")
|
||||
private Integer cid;
|
||||
@ApiModelProperty(value = "商品主图地址", required = true)
|
||||
@ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔")
|
||||
@NotEmpty(message = "商品主图地址不能为空")
|
||||
private List<String> picUrls;
|
||||
@ApiModelProperty(value = "是否上架商品", required = true)
|
||||
@ApiModelProperty(value = "是否上架商品", required = true, example = "true")
|
||||
@NotNull(message = "是否上架商品不能为空")
|
||||
private Boolean visible;
|
||||
|
||||
|
||||
@@ -10,27 +10,25 @@ public class ProductSpuRespVO {
|
||||
|
||||
@ApiModelProperty(value = "SPU 编号", required = true)
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "SPU 名字", required = true)
|
||||
@ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "卖点", required = true)
|
||||
@ApiModelProperty(value = "卖点", required = true, example = "好吃好玩")
|
||||
private String sellPoint;
|
||||
@ApiModelProperty(value = "描述", required = true)
|
||||
@ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈")
|
||||
private String description;
|
||||
@ApiModelProperty(value = "分类编号", required = true)
|
||||
@ApiModelProperty(value = "分类编号", required = true, example = "1")
|
||||
private Integer cid;
|
||||
@ApiModelProperty(value = "商品主图地址", required = true)
|
||||
@ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔")
|
||||
private List<String> picUrls;
|
||||
@ApiModelProperty(value = "是否上架商品", required = true)
|
||||
@ApiModelProperty(value = "是否上架商品", required = true, example = "true")
|
||||
private Boolean visible;
|
||||
@ApiModelProperty(value = "排序字段", required = true)
|
||||
@ApiModelProperty(value = "排序字段", required = true, example = "1024")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "价格", required = true)
|
||||
@ApiModelProperty(value = "价格", required = true, example = "233", notes = "单位:分")
|
||||
private Integer price;
|
||||
@ApiModelProperty(value = "库存数量", required = true)
|
||||
@ApiModelProperty(value = "库存数量", required = true, example = "1024")
|
||||
private Integer quantity;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
@ApiModelProperty(value = "最后更新时间", required = true)
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,44 +3,75 @@ 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 ProductSpuUpdateReqVO {
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@NotNull(message = "SPU 编号不能为空")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "SPU 名字", required = true)
|
||||
|
||||
@ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿")
|
||||
@NotEmpty(message = "SPU 名字不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "卖点", required = true)
|
||||
@ApiModelProperty(value = "卖点", required = true, example = "好吃好玩")
|
||||
@NotEmpty(message = "卖点不能为空")
|
||||
private String sellPoint;
|
||||
@ApiModelProperty(value = "描述", required = true)
|
||||
@ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈")
|
||||
@NotEmpty(message = "描述不能为空")
|
||||
private String description;
|
||||
@ApiModelProperty(value = "分类编号", required = true)
|
||||
@ApiModelProperty(value = "分类编号", required = true, example = "1")
|
||||
@NotNull(message = "分类编号不能为空")
|
||||
private Integer cid;
|
||||
@ApiModelProperty(value = "商品主图地址", required = true)
|
||||
@ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔")
|
||||
@NotEmpty(message = "商品主图地址不能为空")
|
||||
private List<String> picUrls;
|
||||
@ApiModelProperty(value = "是否上架商品", required = true)
|
||||
@ApiModelProperty(value = "是否上架商品", required = true, example = "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<ProductSpuCreateReqVO.Sku> skus;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuPageReq
|
||||
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.ProductSpuAndSkuCreateReqDTO;
|
||||
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuAndSkuUpdateReqDTO;
|
||||
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;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface ProductSpuConvert {
|
||||
|
||||
ProductSpuAndSkuCreateReqDTO convert(ProductSpuCreateReqVO bean);
|
||||
|
||||
ProductSpuUpdateReqDTO convert(ProductSpuUpdateReqVO bean);
|
||||
ProductSpuAndSkuUpdateReqDTO convert(ProductSpuUpdateReqVO bean);
|
||||
|
||||
ProductSpuRespVO convert(ProductSpuRespDTO bean);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user