增加 spu attr 相关接口
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package cn.iocoder.mall.product.api;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.product.api.bo.ProductAttrBO;
|
||||
import cn.iocoder.mall.product.api.bo.ProductAttrPageBO;
|
||||
import cn.iocoder.mall.product.api.bo.ProductAttrSimpleBO;
|
||||
import cn.iocoder.mall.product.api.dto.ProductAttrPageDTO;
|
||||
import cn.iocoder.mall.product.api.bo.ProductAttrValueBO;
|
||||
import cn.iocoder.mall.product.api.dto.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,4 +22,17 @@ public interface ProductAttrService {
|
||||
*/
|
||||
CommonResult<List<ProductAttrSimpleBO>> getProductAttrList();
|
||||
|
||||
CommonResult<ProductAttrBO> addProductAttr(Integer adminId, ProductAttrAddDTO productAttrAddDTO);
|
||||
|
||||
CommonResult<Boolean> updateProductAttr(Integer adminId, ProductAttrUpdateDTO productAttrUpdateDTO);
|
||||
|
||||
CommonResult<Boolean> updateProductAttrStatus(Integer adminId, Integer productAttrId, Integer status);
|
||||
|
||||
|
||||
CommonResult<ProductAttrValueBO> addProductAttrValue(Integer adminId, ProductAttrValueAddDTO productAttrValueAddDTO);
|
||||
|
||||
CommonResult<Boolean> updateProductAttrValue(Integer adminId, ProductAttrValueUpdateDTO productAttrValueUpdateDTO);
|
||||
|
||||
CommonResult<Boolean> updateProductAttrValueStatus(Integer adminId, Integer productAttrValueId, Integer status);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.iocoder.mall.product.api.bo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商品规格 VO
|
||||
*/
|
||||
public class ProductAttrBO {
|
||||
|
||||
/**
|
||||
* 规格编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 规格名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public ProductAttrBO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ProductAttrBO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public ProductAttrBO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public ProductAttrBO setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.iocoder.mall.product.api.bo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商品规格值 VO
|
||||
*/
|
||||
public class ProductAttrValueBO {
|
||||
|
||||
/**
|
||||
* 规格值编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 规格值名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public ProductAttrValueBO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ProductAttrValueBO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public ProductAttrValueBO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public ProductAttrValueBO setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,9 @@ public enum ProductErrorCodeEnum {
|
||||
|
||||
// ========== PRODUCT ATTR + ATTR_VALUE 模块 ==========
|
||||
PRODUCT_ATTR_VALUE_NOT_EXIST(1003003000, "商品属性值不存在"),
|
||||
|
||||
PRODUCT_ATTR_NOT_EXIST(1003003001, "商品属性值不存在"),
|
||||
PRODUCT_ATTR_EXISTS(1003003002, "商品规格已经存在"),
|
||||
PRODUCT_ATTR_STATUS_EQUALS(1003003003, "商品规格已经是该状态"),
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.mall.product.api.dto;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* Product 规格添加 DTO
|
||||
*/
|
||||
public class ProductAttrAddDTO {
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@NotEmpty(message = "规格名不能为空")
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ProductAttrAddDTO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.iocoder.mall.product.api.dto;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Product 规格修改 DTO
|
||||
*/
|
||||
public class ProductAttrUpdateDTO {
|
||||
|
||||
/**
|
||||
* 规格编号
|
||||
*/
|
||||
@NotNull(message = "规格编号不能为空")
|
||||
private Integer id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@NotEmpty(message = "规格名不能为空")
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ProductAttrUpdateDTO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public ProductAttrUpdateDTO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.iocoder.mall.product.api.dto;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Product 规格值添加 DTO
|
||||
*/
|
||||
public class ProductAttrValueAddDTO {
|
||||
|
||||
/**
|
||||
* 规格编号
|
||||
*/
|
||||
@NotNull(message = "规格编号不能为空")
|
||||
private Integer attrId;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@NotEmpty(message = "规格值名不能为空")
|
||||
private String name;
|
||||
|
||||
public Integer getAttrId() {
|
||||
return attrId;
|
||||
}
|
||||
|
||||
public ProductAttrValueAddDTO setAttrId(Integer attrId) {
|
||||
this.attrId = attrId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ProductAttrValueAddDTO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.iocoder.mall.product.api.dto;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Product 规格值修改 DTO
|
||||
*
|
||||
* 注意,不允许修改所属规格
|
||||
*/
|
||||
public class ProductAttrValueUpdateDTO {
|
||||
|
||||
/**
|
||||
* 规格值编号
|
||||
*/
|
||||
@NotNull(message = "规格编号不能为空")
|
||||
private Integer id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@NotEmpty(message = "规格名不能为空")
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ProductAttrValueUpdateDTO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public ProductAttrValueUpdateDTO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user