商品 SPU 开始迁移
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package cn.iocoder.mall.managementweb.controller.product;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuCreateReqVO;
|
||||
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.managementweb.manager.product.ProductSpuManager;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 商品 SPU Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/product_spu")
|
||||
@Api(tags = "商品 SPU")
|
||||
@Validated
|
||||
public class ProductSpuController {
|
||||
|
||||
@Autowired
|
||||
private ProductSpuManager productSpuManager;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建商品 SPU")
|
||||
public CommonResult<Integer> createProductSpu(@Valid ProductSpuCreateReqVO createVO) {
|
||||
return success(productSpuManager.createProductSpu(createVO));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("更新商品 SPU")
|
||||
public CommonResult<Boolean> updateProductSpu(@Valid ProductSpuUpdateReqVO updateVO) {
|
||||
productSpuManager.updateProductSpu(updateVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得商品 SPU")
|
||||
@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)
|
||||
public CommonResult<List<ProductSpuRespVO>> listProductSpus(@RequestParam("productSpuIds") List<Integer> productSpuIds) {
|
||||
return success(productSpuManager.listProductSpus(productSpuIds));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得商品 SPU 分页")
|
||||
public CommonResult<PageResult<ProductSpuRespVO>> pageProductSpu(ProductSpuPageReqVO pageVO) {
|
||||
return success(productSpuManager.pageProductSpu(pageVO));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.iocoder.mall.managementweb.controller.product.vo.spu;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("商品 SPU创建 Request VO")
|
||||
@Data
|
||||
public class ProductSpuCreateReqVO {
|
||||
|
||||
@ApiModelProperty(value = "SPU 名字", required = true)
|
||||
@NotEmpty(message = "SPU 名字不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "卖点", required = true)
|
||||
@NotEmpty(message = "卖点不能为空")
|
||||
private String sellPoint;
|
||||
@ApiModelProperty(value = "描述", required = true)
|
||||
@NotEmpty(message = "描述不能为空")
|
||||
private String description;
|
||||
@ApiModelProperty(value = "分类编号", required = true)
|
||||
@NotNull(message = "分类编号不能为空")
|
||||
private Integer cid;
|
||||
@ApiModelProperty(value = "商品主图地址", required = true)
|
||||
@NotEmpty(message = "商品主图地址不能为空")
|
||||
private String picUrls;
|
||||
@ApiModelProperty(value = "是否上架商品", required = true)
|
||||
@NotNull(message = "是否上架商品不能为空")
|
||||
private Integer 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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.mall.managementweb.controller.product.vo.spu;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("商品 SPU分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ProductSpuPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "SPU 名字", required = true)
|
||||
private String name;
|
||||
@ApiModelProperty(value = "卖点", required = true)
|
||||
private String sellPoint;
|
||||
@ApiModelProperty(value = "描述", required = true)
|
||||
private String description;
|
||||
@ApiModelProperty(value = "分类编号", required = true)
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.iocoder.mall.managementweb.controller.product.vo.spu;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.*;
|
||||
|
||||
@ApiModel("商品 SPU Response VO")
|
||||
@Data
|
||||
public class ProductSpuRespVO {
|
||||
|
||||
@ApiModelProperty(value = "SPU 编号", required = true)
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "SPU 名字", required = true)
|
||||
private String name;
|
||||
@ApiModelProperty(value = "卖点", required = true)
|
||||
private String sellPoint;
|
||||
@ApiModelProperty(value = "描述", required = true)
|
||||
private String description;
|
||||
@ApiModelProperty(value = "分类编号", required = true)
|
||||
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 = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
@ApiModelProperty(value = "最后更新时间", required = true)
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.iocoder.mall.managementweb.controller.product.vo.spu;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("商品 SPU更新 Request VO")
|
||||
@Data
|
||||
public class ProductSpuUpdateReqVO {
|
||||
|
||||
@ApiModelProperty(value = "SPU 编号", required = true)
|
||||
@NotNull(message = "SPU 编号不能为空")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "SPU 名字", required = true)
|
||||
@NotEmpty(message = "SPU 名字不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "卖点", required = true)
|
||||
@NotEmpty(message = "卖点不能为空")
|
||||
private String sellPoint;
|
||||
@ApiModelProperty(value = "描述", required = true)
|
||||
@NotEmpty(message = "描述不能为空")
|
||||
private String description;
|
||||
@ApiModelProperty(value = "分类编号", required = true)
|
||||
@NotNull(message = "分类编号不能为空")
|
||||
private Integer cid;
|
||||
@ApiModelProperty(value = "商品主图地址", required = true)
|
||||
@NotEmpty(message = "商品主图地址不能为空")
|
||||
private String picUrls;
|
||||
@ApiModelProperty(value = "是否上架商品", required = true)
|
||||
@NotNull(message = "是否上架商品不能为空")
|
||||
private Integer 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;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user