商品分类部分提交
This commit is contained in:
@@ -11,4 +11,17 @@
|
||||
|
||||
<artifactId>product-service-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>common-framework</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,11 +1,31 @@
|
||||
package cn.iocoder.mall.product.api;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.product.api.bo.ProductCategoryBO;
|
||||
import cn.iocoder.mall.product.api.dto.ProductCategoryAddDTO;
|
||||
import cn.iocoder.mall.product.api.dto.ProductCategoryUpdateDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProductCategoryService {
|
||||
|
||||
/**
|
||||
* @param pid 指定父分类编号
|
||||
* @return 返回指定分类编号的子产品分类们
|
||||
*/
|
||||
List<ProductCategoryBO> getListByPid(Integer pid);
|
||||
|
||||
/**
|
||||
* @return 返回所有产品分类们
|
||||
*/
|
||||
List<ProductCategoryBO> getAll();
|
||||
|
||||
CommonResult<ProductCategoryBO> addProductCategory(Integer adminId, ProductCategoryAddDTO productCategoryAddDTO);
|
||||
|
||||
CommonResult<Boolean> updateProductCategory(Integer adminId, ProductCategoryUpdateDTO productCategoryUpdateDTO);
|
||||
|
||||
CommonResult<Boolean> updateProductCategoryStatus(Integer adminId, Integer productCategoryId, Integer status);
|
||||
|
||||
CommonResult<Boolean> deleteProductCategory(Integer admin, Integer productCategoryId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.mall.product.api.constant;
|
||||
|
||||
public class ProductCategoryConstants {
|
||||
|
||||
/**
|
||||
* 状态 - 开启
|
||||
*/
|
||||
public static final Integer STATUS_ENABLE = 1;
|
||||
/**
|
||||
* 状态 - 关闭
|
||||
*/
|
||||
public static final Integer STATUS_DISABLE = 1;
|
||||
|
||||
/**
|
||||
* 父分类编号 - 根节点
|
||||
*/
|
||||
public static final Integer PID_ROOT = 0;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.mall.product.api.constant;
|
||||
|
||||
/**
|
||||
* 错误码枚举类
|
||||
*
|
||||
* 商品系统,使用 1-003-000-000 段
|
||||
*/
|
||||
public enum ProductErrorCodeEnum {
|
||||
|
||||
// ========== PRODUCT CATEGORY 模块 ==========
|
||||
PRODUCT_CATEGORY_PARENT_NOT_EXISTS(1003001000, "父分类不存在"),
|
||||
PRODUCT_CATEGORY_NOT_EXISTS(1003001001, "商品分类不存在"),
|
||||
PRODUCT_CATEGORY_PARENT_NOT_SELF(1003001002, "不能设置自己为父分类"),
|
||||
PRODUCT_CATEGORY_STATUS_EQUALS(1002002003, "商品分类已经是该状态"),
|
||||
PRODUCT_CATEGORY_DELETE_ONLY_DISABLE(1002002004, "只有关闭的商品分类才可以删除"),
|
||||
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
||||
ProductErrorCodeEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.iocoder.mall.product.api.dto;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 商品分类添加 DTO
|
||||
*/
|
||||
public class ProductCategoryAddDTO {
|
||||
|
||||
/**
|
||||
* 父分类编号
|
||||
*/
|
||||
@NotNull(message = "父分类编号不能为空")
|
||||
private Integer pid;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@NotNull(message = "名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@NotNull(message = "描述不能为空")
|
||||
private String description;
|
||||
/**
|
||||
* 分类图片
|
||||
*/
|
||||
@NotNull(message = "分类图片不能为空")
|
||||
private String picUrl;
|
||||
/**
|
||||
* 排序值
|
||||
*/
|
||||
@NotNull(message = "排序值不能为空")
|
||||
private Integer sort;
|
||||
|
||||
public Integer getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public ProductCategoryAddDTO setPid(Integer pid) {
|
||||
this.pid = pid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ProductCategoryAddDTO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public ProductCategoryAddDTO setDescription(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public ProductCategoryAddDTO setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public ProductCategoryAddDTO setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package cn.iocoder.mall.product.api.dto;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 商品分类更新 DTO
|
||||
*/
|
||||
public class ProductCategoryUpdateDTO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
/**
|
||||
* 父分类编号
|
||||
*/
|
||||
@NotNull(message = "父分类编号不能为空")
|
||||
private Integer pid;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@NotNull(message = "名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@NotNull(message = "描述不能为空")
|
||||
private String description;
|
||||
/**
|
||||
* 分类图片
|
||||
*/
|
||||
@NotNull(message = "分类图片不能为空")
|
||||
private String picUrl;
|
||||
/**
|
||||
* 排序值
|
||||
*/
|
||||
@NotNull(message = "排序值不能为空")
|
||||
private Integer sort;
|
||||
|
||||
public Integer getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public ProductCategoryUpdateDTO setPid(Integer pid) {
|
||||
this.pid = pid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ProductCategoryUpdateDTO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public ProductCategoryUpdateDTO setDescription(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public ProductCategoryUpdateDTO setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public ProductCategoryUpdateDTO setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public ProductCategoryUpdateDTO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user