商品 Spu + Sku 部分 API 提交

This commit is contained in:
YunaiV
2019-03-04 23:10:48 +08:00
parent 5192472ed5
commit abf1f25033
23 changed files with 859 additions and 88 deletions

View File

@@ -1,9 +1,17 @@
package cn.iocoder.mall.product.api;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.product.api.bo.ProductSpuBO;
import cn.iocoder.mall.product.api.bo.ProductSpuDetailBO;
import cn.iocoder.mall.product.api.dto.ProductSpuAddDTO;
import cn.iocoder.mall.product.api.dto.ProductSpuUpdateDTO;
public interface ProductSpuService {
ProductSpuBO getProductSpu(Integer id);
CommonResult<ProductSpuDetailBO> addProductSpu(Integer adminId, ProductSpuAddDTO productSpuAddDTO);
CommonResult<Boolean> updateProductSpu(Integer adminId, ProductSpuUpdateDTO productSpuUpdateDTO);
}

View File

@@ -0,0 +1,61 @@
package cn.iocoder.mall.product.api.bo;
/**
* 商品规格 BO
*/
public class ProductAttrBO {
/**
* 规格编号
*/
private Integer attrId;
/**
* 规格名
*/
private String attrName;
/**
* 规格值
*/
private Integer attrValueId;
/**
* 规格值名
*/
private String attrValueName;
public Integer getAttrId() {
return attrId;
}
public ProductAttrBO setAttrId(Integer attrId) {
this.attrId = attrId;
return this;
}
public String getAttrName() {
return attrName;
}
public ProductAttrBO setAttrName(String attrName) {
this.attrName = attrName;
return this;
}
public Integer getAttrValueId() {
return attrValueId;
}
public ProductAttrBO setAttrValueId(Integer attrValueId) {
this.attrValueId = attrValueId;
return this;
}
public String getAttrValueName() {
return attrValueName;
}
public ProductAttrBO setAttrValueName(String attrValueName) {
this.attrValueName = attrValueName;
return this;
}
}

View File

@@ -0,0 +1,45 @@
package cn.iocoder.mall.product.api.bo;
import java.util.List;
/**
* 商品 Sku 明细 BO
*/
public class ProductSkuDetailBO {
/**
* sku 编号
*/
private Integer id;
/**
* 商品编号
*/
private Integer itemId;
// TODO 店铺编号
/**
* 状态
*
* 1-正常
* 2-禁用
*/
private Integer status;
/**
* 图片地址
*/
private String picURL;
/**
* 规格值数组
*/
private List<ProductAttrBO> attrs;
/**
* 价格,单位:分
*/
private Integer price;
/**
* 库存数量
*/
private Integer quantity;
}

View File

@@ -0,0 +1,65 @@
package cn.iocoder.mall.product.api.bo;
import cn.iocoder.mall.product.api.dto.ProductSkuAddDTO;
import java.util.List;
/**
* 商品 Spu 明细 BO包括 Sku 明细)
*/
public class ProductSpuDetailBO {
/**
* SPU 编号
*/
private Integer id;
// ========== 基本信息 =========
/**
* SPU 名字
*/
private String name;
/**
* 卖点
*/
private String sellPoint;
/**
* 描述
*/
private String description;
/**
* 分类编号
*/
private Integer cid;
/**
* 商品主图地址
*
* 数组,以逗号分隔
*
* 建议尺寸800*800像素你可以拖拽图片调整顺序最多上传15张
*/
private List<String> picUrls;
// ========== 其他信息 =========
/**
* 是否上架商品(是否可见)。
*
* true 为已上架
* false 为已下架
*/
private Boolean visible;
/**
* 排序字段
*/
private Integer order;
//
// ========== SKU =========
/**
* SKU 数组
*/
private List<ProductSkuAddDTO> skus;
}

View File

@@ -0,0 +1,50 @@
package cn.iocoder.mall.product.api.dto;
import java.util.List;
/**
* 商品 Sku 添加 DTO
*/
public class ProductSkuAddDTO {
/**
* 规格值数组
*/
private List<Integer> attrs;
/**
* 价格,单位:分
*/
private Integer price;
/**
* 库存数量
*/
private Integer quantity;
public List<Integer> getAttrs() {
return attrs;
}
public ProductSkuAddDTO setAttrs(List<Integer> attrs) {
this.attrs = attrs;
return this;
}
public Integer getPrice() {
return price;
}
public ProductSkuAddDTO setPrice(Integer price) {
this.price = price;
return this;
}
public Integer getQuantity() {
return quantity;
}
public ProductSkuAddDTO setQuantity(Integer quantity) {
this.quantity = quantity;
return this;
}
}

View File

@@ -0,0 +1,50 @@
package cn.iocoder.mall.product.api.dto;
import java.util.List;
/**
* 商品 Sku 更新 DTO
*/
public class ProductSkuUpdateDTO {
/**
* 规格值数组
*/
private List<Integer> attrs;
/**
* 价格,单位:分
*/
private Integer price;
/**
* 库存数量
*/
private Integer quantity;
public List<Integer> getAttrs() {
return attrs;
}
public ProductSkuUpdateDTO setAttrs(List<Integer> attrs) {
this.attrs = attrs;
return this;
}
public Integer getPrice() {
return price;
}
public ProductSkuUpdateDTO setPrice(Integer price) {
this.price = price;
return this;
}
public Integer getQuantity() {
return quantity;
}
public ProductSkuUpdateDTO setQuantity(Integer quantity) {
this.quantity = quantity;
return this;
}
}

View File

@@ -0,0 +1,120 @@
package cn.iocoder.mall.product.api.dto;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 商品 SPU + SKU 添加 DTO
*/
public class ProductSpuAddDTO {
// ========== 基本信息 =========
/**
* SPU 名字
*/
@NotEmpty(message = "SPU 名字不能为空")
private String name;
/**
* 卖点
*/
@NotEmpty(message = "卖点不能为空")
private String sellPoint;
/**
* 描述
*/
@NotEmpty(message = "描述不能为空")
private String description;
/**
* 分类编号
*/
@NotEmpty(message = "分类不能为空")
private Integer cid;
/**
* 商品主图地址
*/
@NotNull(message = "商品主图不能为空")
private List<String> picUrls;
// ========== 其他信息 =========
/**
* 是否上架商品(是否可见)。
*
* true 为已上架
* false 为已下架
*/
@NotNull(message = "是否上架不能为空")
private Boolean visible;
// ========== SKU =========
/**
* SKU 数组
*/
@NotNull(message = "SKU 不能为空")
private List<ProductSkuAddDTO> skus;
public String getName() {
return name;
}
public ProductSpuAddDTO setName(String name) {
this.name = name;
return this;
}
public String getSellPoint() {
return sellPoint;
}
public ProductSpuAddDTO setSellPoint(String sellPoint) {
this.sellPoint = sellPoint;
return this;
}
public String getDescription() {
return description;
}
public ProductSpuAddDTO setDescription(String description) {
this.description = description;
return this;
}
public Integer getCid() {
return cid;
}
public ProductSpuAddDTO setCid(Integer cid) {
this.cid = cid;
return this;
}
public List<String> getPicUrls() {
return picUrls;
}
public ProductSpuAddDTO setPicUrls(List<String> picUrls) {
this.picUrls = picUrls;
return this;
}
public Boolean getVisible() {
return visible;
}
public ProductSpuAddDTO setVisible(Boolean visible) {
this.visible = visible;
return this;
}
public List<ProductSkuAddDTO> getSkus() {
return skus;
}
public ProductSpuAddDTO setSkus(List<ProductSkuAddDTO> skus) {
this.skus = skus;
return this;
}
}

View File

@@ -0,0 +1,134 @@
package cn.iocoder.mall.product.api.dto;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 商品 SPU + SKU 更新 DTO
*/
public class ProductSpuUpdateDTO {
/**
* Spu 编号
*/
@NotNull(message = "SPU 编号不能为空")
private Integer id;
// ========== 基本信息 =========
/**
* SPU 名字
*/
@NotEmpty(message = "SPU 名字不能为空")
private String name;
/**
* 卖点
*/
@NotEmpty(message = "卖点不能为空")
private String sellPoint;
/**
* 描述
*/
@NotEmpty(message = "描述不能为空")
private String description;
/**
* 分类编号
*/
@NotEmpty(message = "分类不能为空")
private Integer cid;
/**
* 商品主图地址
*/
@NotNull(message = "商品主图不能为空")
private List<String> picUrls;
// ========== 其他信息 =========
/**
* 是否上架商品(是否可见)。
*
* true 为已上架
* false 为已下架
*/
@NotNull(message = "是否上架不能为空")
private Boolean visible;
// ========== SKU =========
/**
* SKU 数组
*/
@NotNull(message = "SKU 不能为空")
private List<ProductSkuUpdateDTO> skus;
public String getName() {
return name;
}
public ProductSpuUpdateDTO setName(String name) {
this.name = name;
return this;
}
public String getSellPoint() {
return sellPoint;
}
public ProductSpuUpdateDTO setSellPoint(String sellPoint) {
this.sellPoint = sellPoint;
return this;
}
public String getDescription() {
return description;
}
public ProductSpuUpdateDTO setDescription(String description) {
this.description = description;
return this;
}
public Integer getCid() {
return cid;
}
public ProductSpuUpdateDTO setCid(Integer cid) {
this.cid = cid;
return this;
}
public List<String> getPicUrls() {
return picUrls;
}
public ProductSpuUpdateDTO setPicUrls(List<String> picUrls) {
this.picUrls = picUrls;
return this;
}
public Boolean getVisible() {
return visible;
}
public ProductSpuUpdateDTO setVisible(Boolean visible) {
this.visible = visible;
return this;
}
public List<ProductSkuUpdateDTO> getSkus() {
return skus;
}
public ProductSpuUpdateDTO setSkus(List<ProductSkuUpdateDTO> skus) {
this.skus = skus;
return this;
}
public Integer getId() {
return id;
}
public ProductSpuUpdateDTO setId(Integer id) {
this.id = id;
return this;
}
}