From a99afdc833a2f917fed37dfde66e562f76647367 Mon Sep 17 00:00:00 2001
From: YunaiV <>
Date: Sat, 25 Jul 2020 00:10:10 +0800
Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB=E7=9A=84?=
=?UTF-8?q?=E8=BF=81=E7=A7=BB=EF=BC=8C=E7=BB=A7=E7=BB=AD=E6=9C=AA=E5=AE=8C?=
=?UTF-8?q?=E6=88=90=EF=BC=8C=E7=BB=A7=E7=BB=AD=E5=85=88=E6=8F=90=E4=BA=A4?=
=?UTF-8?q?=E4=B8=8B~?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
management-web-app/pom.xml | 6 +
.../product/ProductCategoryController.java | 54 +++++++++
.../category/ProductCategoryCreateReqVO.java | 34 ++++++
.../vo/category/ProductCategoryRespVO.java | 26 +++++
.../ProductCategoryTreeNodeRespVO.java | 33 ++++++
.../category/ProductCategoryUpdateReqVO.java | 37 ++++++
.../product/ProductCategoryConvert.java | 26 +++++
.../product/ProductCategoryManager.java | 106 ++++++++++++++++++
.../src/main/resources/application.yml | 2 +
.../rpc/category/ProductCategoryRpc.java | 61 ++++++++++
.../dto/ProductCategoryCreateReqDTO.java | 49 ++++++++
.../dto/ProductCategoryListQueryReqDTO.java | 18 +++
.../category/dto/ProductCategoryRespDTO.java | 22 ++--
.../dto/ProductCategoryUpdateReqDTO.java | 54 +++++++++
.../category/ProductCategoryConvert.java | 15 +++
.../category/ProductCategoryDO.java | 2 +-
.../category/ProductCategoryMapper.java | 8 ++
.../category/ProductCategoryManager.java | 86 ++++++++++++++
.../rpc/category/ProductCategoryRpcImpl.java | 57 ++++++++++
.../category/ProductCategoryService.java | 49 ++++----
.../category/bo/ProductCategoryBO.java | 2 +-
.../category/bo/ProductCategoryCreateBO.java | 2 +-
.../bo/ProductCategoryListQueryBO.java | 18 +++
.../category/bo/ProductCategoryUpdateBO.java | 2 +-
.../mall/product/biz/bo/package-info.java | 5 -
.../biz/config/DatabaseConfiguration.java | 26 -----
.../category/ProductCategoryConvert.java | 58 ----------
.../product/biz/convert/package-info.java | 5 -
.../dao/category/ProductCategoryMapper.java | 25 -----
.../mall/product/biz/dao/package-info.java | 5 -
.../category/ProductCategoryDO.java | 50 ---------
.../product/biz/dataobject/package-info.java | 5 -
.../dto/category/ProductCategoryAddDTO.java | 48 --------
.../category/ProductCategoryDeleteDTO.java | 28 -----
.../category/ProductCategoryUpdateDTO.java | 52 ---------
.../ProductCategoryUpdateStatusDTO.java | 33 ------
.../category/ProductCategoryService.java | 69 ------------
.../category/ProductCategoryServiceImpl.java | 42 -------
.../product/biz/service/package-info.java | 5 -
.../AdminsProductCategoryConvert.java | 69 ------------
.../AdminsProductCategoryAddRequest.java | 38 -------
.../AdminsProductCategoryUpdateRequest.java | 42 -------
...insProductCategoryUpdateStatusRequest.java | 27 -----
.../service/permission/ResourceService.java | 4 +-
44 files changed, 731 insertions(+), 674 deletions(-)
create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.java
create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryCreateReqVO.java
create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryRespVO.java
create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryTreeNodeRespVO.java
create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryUpdateReqVO.java
create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductCategoryConvert.java
create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductCategoryManager.java
create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryRpc.java
create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryCreateReqDTO.java
create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryListQueryReqDTO.java
rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryBO.java => product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryRespDTO.java (63%)
create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryUpdateReqDTO.java
create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/category/ProductCategoryManager.java
create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryRpcImpl.java
create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryListQueryBO.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/package-info.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/config/DatabaseConfiguration.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/category/ProductCategoryConvert.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/package-info.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/category/ProductCategoryMapper.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/package-info.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/category/ProductCategoryDO.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/package-info.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryAddDTO.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryDeleteDTO.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryUpdateDTO.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryUpdateStatusDTO.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryService.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryServiceImpl.java
delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/package-info.java
delete mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/category/AdminsProductCategoryConvert.java
delete mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryAddRequest.java
delete mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateRequest.java
delete mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateStatusRequest.java
diff --git a/management-web-app/pom.xml b/management-web-app/pom.xml
index 70ef8d3eb..2a1025e36 100644
--- a/management-web-app/pom.xml
+++ b/management-web-app/pom.xml
@@ -60,6 +60,12 @@
system-service-api
1.0-SNAPSHOT
+
+
+ cn.iocoder.mall
+ product-service-api
+ 1.0-SNAPSHOT
+
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.java
new file mode 100644
index 000000000..5b12cfa7f
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.java
@@ -0,0 +1,54 @@
+package cn.iocoder.mall.managementweb.controller.product;
+
+import cn.iocoder.common.framework.vo.CommonResult;
+import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryCreateReqVO;
+import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryUpdateReqVO;
+import cn.iocoder.mall.managementweb.manager.product.ProductCategoryManager;
+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.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+import static cn.iocoder.common.framework.vo.CommonResult.success;
+
+/**
+* 商品分类 Controller
+*/
+@RestController
+@RequestMapping("/product_category")
+@Api(tags = "商品分类")
+@Validated
+public class ProductCategoryController {
+
+ @Autowired
+ private ProductCategoryManager productCategoryManager;
+
+ @PostMapping("/create")
+ @ApiOperation("创建商品分类")
+ public CommonResult createProductCategory(@Valid ProductCategoryCreateReqVO createVO) {
+ return success(productCategoryManager.createProductCategory(createVO));
+ }
+
+ @PostMapping("/update")
+ @ApiOperation("更新商品分类")
+ public CommonResult updateProductCategory(@Valid ProductCategoryUpdateReqVO updateVO) {
+ productCategoryManager.updateProductCategory(updateVO);
+ return success(true);
+ }
+
+ @PostMapping("/delete")
+ @ApiOperation("删除商品分类")
+ @ApiImplicitParam(name = "productCategoryId", value = "商品分类编号", required = true)
+ public CommonResult deleteProductCategory(@RequestParam("productCategoryId") Integer productCategoryId) {
+ productCategoryManager.deleteProductCategory(productCategoryId);
+ return success(true);
+ }
+
+}
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryCreateReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryCreateReqVO.java
new file mode 100644
index 000000000..bb5535e2b
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryCreateReqVO.java
@@ -0,0 +1,34 @@
+package cn.iocoder.mall.managementweb.controller.product.vo.category;
+
+import cn.iocoder.common.framework.enums.CommonStatusEnum;
+import cn.iocoder.common.framework.validator.InEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+@ApiModel("商品分类创建 Request VO")
+@Data
+public class ProductCategoryCreateReqVO {
+
+ @ApiModelProperty(value = "父分类编号", required = true, example = "0")
+ @NotNull(message = "父分类编号不能为空")
+ private Integer pid;
+ @ApiModelProperty(value = "分类名称", required = true, example = "手机")
+ @NotEmpty(message = "分类名称不能为空")
+ private String name;
+ @ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊")
+ private String description;
+ @ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
+ private String picUrl;
+ @ApiModelProperty(value = "分类排序", required = true, example = "10")
+ @NotNull(message = "分类排序不能为空")
+ private Integer sort;
+ @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
+ @NotNull(message = "状态不能为空")
+ @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
+ private Integer status;
+
+}
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryRespVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryRespVO.java
new file mode 100644
index 000000000..e345d0cd4
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryRespVO.java
@@ -0,0 +1,26 @@
+package cn.iocoder.mall.managementweb.controller.product.vo.category;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@ApiModel("商品分类 Response VO")
+@Data
+public class ProductCategoryRespVO {
+
+ @ApiModelProperty(value = "分类编号", required = true, example = "1")
+ private Integer id;
+ @ApiModelProperty(value = "父分类编号", required = true, example = "0")
+ private Integer pid;
+ @ApiModelProperty(value = "分类名称", required = true, example = "手机")
+ private String name;
+ @ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊")
+ private String description;
+ @ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
+ private String picUrl;
+ @ApiModelProperty(value = "分类排序", required = true, example = "10")
+ private Integer sort;
+ @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
+ private Integer status;
+
+}
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryTreeNodeRespVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryTreeNodeRespVO.java
new file mode 100644
index 000000000..503e3edd7
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryTreeNodeRespVO.java
@@ -0,0 +1,33 @@
+package cn.iocoder.mall.managementweb.controller.product.vo.category;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@ApiModel("商品分类 Response VO")
+@Data
+public class ProductCategoryTreeNodeRespVO {
+
+ @ApiModelProperty(value = "分类编号", required = true, example = "1")
+ private Integer id;
+ @ApiModelProperty(value = "父分类编号", required = true, example = "0")
+ private Integer pid;
+ @ApiModelProperty(value = "分类名称", required = true, example = "手机")
+ private String name;
+ @ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊")
+ private String description;
+ @ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
+ private String picUrl;
+ @ApiModelProperty(value = "分类排序", required = true, example = "10")
+ private Integer sort;
+ @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
+ private Integer status;
+
+ /**
+ * 子节点
+ */
+ private List children;
+
+}
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryUpdateReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryUpdateReqVO.java
new file mode 100644
index 000000000..dd358ef00
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryUpdateReqVO.java
@@ -0,0 +1,37 @@
+package cn.iocoder.mall.managementweb.controller.product.vo.category;
+
+import cn.iocoder.common.framework.enums.CommonStatusEnum;
+import cn.iocoder.common.framework.validator.InEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+@ApiModel("商品分类更新 Request VO")
+@Data
+public class ProductCategoryUpdateReqVO {
+
+ @ApiModelProperty(value = "分类编号", required = true, example = "1")
+ @NotNull(message = "分类编号不能为空")
+ private Integer id;
+ @ApiModelProperty(value = "父分类编号", required = true, example = "0")
+ @NotNull(message = "父分类编号不能为空")
+ private Integer pid;
+ @ApiModelProperty(value = "分类名称", required = true, example = "手机")
+ @NotEmpty(message = "分类名称不能为空")
+ private String name;
+ @ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊")
+ private String description;
+ @ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
+ private String picUrl;
+ @ApiModelProperty(value = "分类排序", required = true, example = "10")
+ @NotNull(message = "分类排序不能为空")
+ private Integer sort;
+ @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
+ @NotNull(message = "状态不能为空")
+ @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
+ private Integer status;
+
+}
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductCategoryConvert.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductCategoryConvert.java
new file mode 100644
index 000000000..570c86567
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductCategoryConvert.java
@@ -0,0 +1,26 @@
+package cn.iocoder.mall.managementweb.convert.product;
+
+import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryCreateReqVO;
+import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryRespVO;
+import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryTreeNodeRespVO;
+import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryUpdateReqVO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+@Mapper
+public interface ProductCategoryConvert {
+
+ ProductCategoryConvert INSTANCE = Mappers.getMapper(ProductCategoryConvert.class);
+
+ ProductCategoryCreateReqDTO convert(ProductCategoryCreateReqVO bean);
+
+ ProductCategoryUpdateReqDTO convert(ProductCategoryUpdateReqVO bean);
+
+ ProductCategoryRespVO convert(ProductCategoryRespDTO bean);
+
+ ProductCategoryTreeNodeRespVO convertTreeNode(ProductCategoryRespDTO bean);
+
+}
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductCategoryManager.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductCategoryManager.java
new file mode 100644
index 000000000..59ffbb490
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductCategoryManager.java
@@ -0,0 +1,106 @@
+package cn.iocoder.mall.managementweb.manager.product;
+
+import cn.iocoder.common.framework.vo.CommonResult;
+import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryCreateReqVO;
+import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryTreeNodeRespVO;
+import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryUpdateReqVO;
+import cn.iocoder.mall.managementweb.convert.product.ProductCategoryConvert;
+import cn.iocoder.mall.productservice.enums.category.ProductCategoryIdEnum;
+import cn.iocoder.mall.productservice.rpc.category.ProductCategoryRpc;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.Reference;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+* 商品分类表 Manager
+*/
+@Service
+@Slf4j
+public class ProductCategoryManager {
+
+ @Reference(version = "${dubbo.consumer.ProductCategoryRpc.version}")
+ private ProductCategoryRpc productCategoryRpc;
+
+ /**
+ * 创建商品分类表
+ *
+ * @param createVO 创建商品分类表 VO
+ * @return 商品分类表
+ */
+ public Integer createProductCategory(ProductCategoryCreateReqVO createVO) {
+ CommonResult createProductCategoryResult = productCategoryRpc.createProductCategory(ProductCategoryConvert.INSTANCE.convert(createVO));
+ createProductCategoryResult.checkError();
+ return createProductCategoryResult.getData();
+ }
+
+ /**
+ * 更新商品分类表
+ *
+ * @param updateVO 更新商品分类表 VO
+ */
+ public void updateProductCategory(ProductCategoryUpdateReqVO updateVO) {
+ CommonResult updateProductCategoryResult = productCategoryRpc.updateProductCategory(ProductCategoryConvert.INSTANCE.convert(updateVO));
+ updateProductCategoryResult.checkError();
+ }
+
+ /**
+ * 删除商品分类表
+ *
+ * @param productCategoryId 商品分类表编号
+ */
+ public void deleteProductCategory(Integer productCategoryId) {
+ CommonResult deleteProductCategoryResult = productCategoryRpc.deleteProductCategory(productCategoryId);
+ deleteProductCategoryResult.checkError();
+ }
+
+ /**
+ * 获得商品分类树结构
+ *
+ * @return 商品分类树结构
+ */
+ public List treeProductCategory() {
+ // 获得商品分类全列表
+ CommonResult> listProductCategories = productCategoryRpc.listProductCategories(new ProductCategoryListQueryReqDTO());
+ listProductCategories.checkError();
+ // 构建菜单树
+ return buildProductCategoryTree(listProductCategories.getData());
+ }
+
+ /**
+ * 构建商品分类树
+ *
+ * @param productCategories 商品分类列表
+ * @return 商品分类树
+ */
+ private static List buildProductCategoryTree(List productCategories) {
+ // 排序,保证菜单的有序性
+ productCategories.sort(Comparator.comparing(ProductCategoryRespDTO::getSort));
+ // 构建菜单树
+ // 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。
+ Map treeNodeMap = new LinkedHashMap<>();
+ productCategories.forEach(category -> treeNodeMap.put(category.getId(), ProductCategoryConvert.INSTANCE.convertTreeNode(category)));
+ // 处理父子关系
+ treeNodeMap.values().stream().filter(node -> !node.getPid().equals(ProductCategoryIdEnum.ROOT.getId())).forEach((childNode) -> {
+ // 获得父节点
+ ProductCategoryTreeNodeRespVO parentNode = treeNodeMap.get(childNode.getPid());
+ if (parentNode == null) {
+ log.error("[buildProductCategoryTree][category({}) 找不到父商品分类({})]", childNode.getId(), childNode.getPid());
+ return;
+ }
+ // 将自己添加到父节点中
+ if (parentNode.getChildren() == null) {
+ parentNode.setChildren(new ArrayList<>());
+ }
+ parentNode.getChildren().add(childNode);
+ });
+ // 获得到所有的根节点
+ return treeNodeMap.values().stream().filter(node -> node.getPid().equals(ProductCategoryIdEnum.ROOT.getId()))
+ .collect(Collectors.toList());
+ }
+
+}
diff --git a/management-web-app/src/main/resources/application.yml b/management-web-app/src/main/resources/application.yml
index 0a24c2fd0..181ad02bc 100644
--- a/management-web-app/src/main/resources/application.yml
+++ b/management-web-app/src/main/resources/application.yml
@@ -49,6 +49,8 @@ dubbo:
version: 1.0.0
ErrorCodeRpc:
version: 1.0.0
+ ProductCategoryRpc:
+ version: 1.0.0
# Swagger 配置项
swagger:
diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryRpc.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryRpc.java
new file mode 100644
index 000000000..1c79a7a24
--- /dev/null
+++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryRpc.java
@@ -0,0 +1,61 @@
+package cn.iocoder.mall.productservice.rpc.category;
+
+import cn.iocoder.common.framework.vo.CommonResult;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO;
+
+import java.util.List;
+
+/**
+* 商品分类 Rpc 接口
+*/
+public interface ProductCategoryRpc {
+
+ /**
+ * 创建商品分类
+ *
+ * @param createDTO 创建商品分类 DTO
+ * @return 商品分类编号
+ */
+ CommonResult createProductCategory(ProductCategoryCreateReqDTO createDTO);
+
+ /**
+ * 更新商品分类
+ *
+ * @param updateDTO 更新商品分类 DTO
+ */
+ CommonResult updateProductCategory(ProductCategoryUpdateReqDTO updateDTO);
+
+ /**
+ * 删除商品分类
+ *
+ * @param productCategoryId 商品分类编号
+ */
+ CommonResult deleteProductCategory(Integer productCategoryId);
+
+ /**
+ * 获得商品分类
+ *
+ * @param productCategoryId 商品分类编号
+ * @return 商品分类
+ */
+ CommonResult getProductCategory(Integer productCategoryId);
+
+ /**
+ * 获得商品分类列表
+ *
+ * @param productCategoryIds 商品分类编号列表
+ * @return 商品分类列表
+ */
+ CommonResult> listProductCategories(List productCategoryIds);
+
+ /**
+ * 获得符合条件的商品分类列表
+ *
+ * @return 商品分类列表
+ */
+ CommonResult> listProductCategories(ProductCategoryListQueryReqDTO listQueryReqDTO);
+
+}
diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryCreateReqDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryCreateReqDTO.java
new file mode 100644
index 000000000..cb895f39d
--- /dev/null
+++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryCreateReqDTO.java
@@ -0,0 +1,49 @@
+package cn.iocoder.mall.productservice.rpc.category.dto;
+
+import cn.iocoder.common.framework.enums.CommonStatusEnum;
+import cn.iocoder.common.framework.validator.InEnum;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+* 商品分类创建 Request DTO
+*/
+@Data
+@Accessors(chain = true)
+public class ProductCategoryCreateReqDTO implements Serializable {
+
+ /**
+ * 父分类编号
+ */
+ @NotNull(message = "父分类编号不能为空")
+ private Integer pid;
+ /**
+ * 分类名称
+ */
+ @NotEmpty(message = "分类名称不能为空")
+ private String name;
+ /**
+ * 分类描述
+ */
+ private String description;
+ /**
+ * 分类图片
+ */
+ private String picUrl;
+ /**
+ * 分类排序
+ */
+ @NotNull(message = "分类排序不能为空")
+ private Integer sort;
+ /**
+ * 状态
+ */
+ @NotNull(message = "状态不能为空")
+ @InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}")
+ private Integer status;
+
+}
diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryListQueryReqDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryListQueryReqDTO.java
new file mode 100644
index 000000000..c45856dad
--- /dev/null
+++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryListQueryReqDTO.java
@@ -0,0 +1,18 @@
+package cn.iocoder.mall.productservice.rpc.category.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 商品分类列表查询 DTO
+ */
+@Data
+@Accessors(chain = true)
+public class ProductCategoryListQueryReqDTO {
+
+ /**
+ * 父编号
+ */
+ private Integer pid;
+
+}
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryBO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryRespDTO.java
similarity index 63%
rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryBO.java
rename to product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryRespDTO.java
index 556d42248..3e40afcf9 100644
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryBO.java
+++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryRespDTO.java
@@ -1,18 +1,17 @@
-package cn.iocoder.mall.product.biz.bo.category;
+package cn.iocoder.mall.productservice.rpc.category.dto;
import lombok.Data;
import lombok.experimental.Accessors;
+import java.io.Serializable;
import java.util.Date;
/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 商品分类 - 商品分类统一BO
- */
+* 商品分类 Response DTO
+*/
@Data
@Accessors(chain = true)
-public class ProductCategoryBO {
+public class ProductCategoryRespDTO implements Serializable {
/**
* 分类编号
@@ -20,16 +19,14 @@ public class ProductCategoryBO {
private Integer id;
/**
* 父分类编号
- *
- * 如果不存在父级,则 pid = 0 。
*/
private Integer pid;
/**
- * 名称
+ * 分类名称
*/
private String name;
/**
- * 描述
+ * 分类描述
*/
private String description;
/**
@@ -37,14 +34,11 @@ public class ProductCategoryBO {
*/
private String picUrl;
/**
- * 排序值
+ * 分类排序
*/
private Integer sort;
/**
* 状态
- *
- * 1-开启
- * 2-关闭
*/
private Integer status;
/**
diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryUpdateReqDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryUpdateReqDTO.java
new file mode 100644
index 000000000..95ab82806
--- /dev/null
+++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryUpdateReqDTO.java
@@ -0,0 +1,54 @@
+package cn.iocoder.mall.productservice.rpc.category.dto;
+
+import cn.iocoder.common.framework.enums.CommonStatusEnum;
+import cn.iocoder.common.framework.validator.InEnum;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+* 商品分类更新 Request DTO
+*/
+@Data
+@Accessors(chain = true)
+public class ProductCategoryUpdateReqDTO implements Serializable {
+
+ /**
+ * 分类编号
+ */
+ @NotNull(message = "分类编号不能为空")
+ private Integer id;
+ /**
+ * 父分类编号
+ */
+ @NotNull(message = "父分类编号不能为空")
+ private Integer pid;
+ /**
+ * 分类名称
+ */
+ @NotEmpty(message = "分类名称不能为空")
+ private String name;
+ /**
+ * 分类描述
+ */
+ private String description;
+ /**
+ * 分类图片
+ */
+ private String picUrl;
+ /**
+ * 分类排序
+ */
+ @NotNull(message = "分类排序不能为空")
+ private Integer sort;
+ /**
+ * 状态
+ */
+ @NotNull(message = "状态不能为空")
+ @InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}")
+ private Integer status;
+
+}
diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/category/ProductCategoryConvert.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/category/ProductCategoryConvert.java
index aada2b4d4..29451b12e 100644
--- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/category/ProductCategoryConvert.java
+++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/category/ProductCategoryConvert.java
@@ -1,8 +1,13 @@
package cn.iocoder.mall.productservice.convert.category;
import cn.iocoder.mall.productservice.dal.mysql.dataobject.category.ProductCategoryDO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO;
import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryBO;
import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryCreateBO;
+import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryListQueryBO;
import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryUpdateBO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@@ -22,4 +27,14 @@ public interface ProductCategoryConvert {
ProductCategoryDO convert(ProductCategoryUpdateBO bean);
+ ProductCategoryCreateBO convert(ProductCategoryCreateReqDTO bean);
+
+ ProductCategoryUpdateBO convert(ProductCategoryUpdateReqDTO bean);
+
+ ProductCategoryRespDTO convert(ProductCategoryBO bean);
+
+ List convertList02(List list);
+
+ ProductCategoryListQueryBO convert(ProductCategoryListQueryReqDTO bean);
+
}
diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/category/ProductCategoryDO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/category/ProductCategoryDO.java
index 4ffcc962b..25e5f0a66 100644
--- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/category/ProductCategoryDO.java
+++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/category/ProductCategoryDO.java
@@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
-* 商品分类表
+* 商品分类 DO
*/
@TableName("product_category")
@Data
diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/category/ProductCategoryMapper.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/category/ProductCategoryMapper.java
index 8d86d1242..5b4e4cd7d 100644
--- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/category/ProductCategoryMapper.java
+++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/category/ProductCategoryMapper.java
@@ -1,10 +1,14 @@
package cn.iocoder.mall.productservice.dal.mysql.mapper.category;
+import cn.iocoder.mall.mybatis.core.query.QueryWrapperX;
import cn.iocoder.mall.productservice.dal.mysql.dataobject.category.ProductCategoryDO;
+import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryListQueryBO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
+import java.util.List;
+
@Repository
public interface ProductCategoryMapper extends BaseMapper {
@@ -12,4 +16,8 @@ public interface ProductCategoryMapper extends BaseMapper {
return selectCount(new QueryWrapper().eq("pid", pid));
}
+ default List selectList(ProductCategoryListQueryBO listQueryBO) {
+ return selectList(new QueryWrapperX().eqIfPresent("pid", listQueryBO.getPid()));
+ }
+
}
diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/category/ProductCategoryManager.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/category/ProductCategoryManager.java
new file mode 100644
index 000000000..e39ebb21b
--- /dev/null
+++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/category/ProductCategoryManager.java
@@ -0,0 +1,86 @@
+package cn.iocoder.mall.productservice.manager.category;
+
+import cn.iocoder.mall.productservice.convert.category.ProductCategoryConvert;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO;
+import cn.iocoder.mall.productservice.service.category.ProductCategoryService;
+import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryBO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+* 商品分类 Manager
+*/
+@Service
+public class ProductCategoryManager {
+
+ @Autowired
+ private ProductCategoryService productCategoryService;
+
+ /**
+ * 创建商品分类
+ *
+ * @param createDTO 创建商品分类 DTO
+ * @return 商品分类
+ */
+ public Integer createProductCategory(ProductCategoryCreateReqDTO createDTO) {
+ ProductCategoryBO productCategoryBO = productCategoryService.createProductCategory(ProductCategoryConvert.INSTANCE.convert(createDTO));
+ return productCategoryBO.getId();
+ }
+
+ /**
+ * 更新商品分类
+ *
+ * @param updateDTO 更新商品分类 DTO
+ */
+ public void updateProductCategory(ProductCategoryUpdateReqDTO updateDTO) {
+ productCategoryService.updateProductCategory(ProductCategoryConvert.INSTANCE.convert(updateDTO));
+ }
+
+ /**
+ * 删除商品分类
+ *
+ * @param productCategoryId 商品分类编号
+ */
+ public void deleteProductCategory(Integer productCategoryId) {
+ productCategoryService.deleteProductCategory(productCategoryId);
+ }
+
+ /**
+ * 获得商品分类
+ *
+ * @param productCategoryId 商品分类编号
+ * @return 商品分类
+ */
+ public ProductCategoryRespDTO getProductCategory(Integer productCategoryId) {
+ ProductCategoryBO productCategoryBO = productCategoryService.getProductCategory(productCategoryId);
+ return ProductCategoryConvert.INSTANCE.convert(productCategoryBO);
+ }
+
+ /**
+ * 获得商品分类列表
+ *
+ * @param productCategoryIds 商品分类编号列表
+ * @return 商品分类列表
+ */
+ public List listProductCategories(List productCategoryIds) {
+ List productCategoryBOs = productCategoryService.listProductCategories(productCategoryIds);
+ return ProductCategoryConvert.INSTANCE.convertList02(productCategoryBOs);
+ }
+
+ /**
+ * 获得商品分类全列表
+ *
+ * @return 商品分类全列表
+ */
+ public List listProductCategories(ProductCategoryListQueryReqDTO listQueryReqDTO) {
+ List productCategoryBOs = productCategoryService.listProductCategories(
+ ProductCategoryConvert.INSTANCE.convert(listQueryReqDTO));
+ return ProductCategoryConvert.INSTANCE.convertList02(productCategoryBOs);
+ }
+
+}
diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryRpcImpl.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryRpcImpl.java
new file mode 100644
index 000000000..65eb1ed20
--- /dev/null
+++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryRpcImpl.java
@@ -0,0 +1,57 @@
+package cn.iocoder.mall.productservice.rpc.category;
+
+import cn.iocoder.common.framework.vo.CommonResult;
+import cn.iocoder.mall.productservice.manager.category.ProductCategoryManager;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
+import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO;
+import org.apache.dubbo.config.annotation.DubboService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+import static cn.iocoder.common.framework.vo.CommonResult.success;
+
+/**
+* 商品分类 Rpc 实现类
+*/
+@DubboService(version = "${dubbo.provider.ProductCategoryRpc.version}")
+public class ProductCategoryRpcImpl implements ProductCategoryRpc {
+
+ @Autowired
+ private ProductCategoryManager productCategoryManager;
+
+ @Override
+ public CommonResult createProductCategory(ProductCategoryCreateReqDTO createDTO) {
+ return success(productCategoryManager.createProductCategory(createDTO));
+ }
+
+ @Override
+ public CommonResult updateProductCategory(ProductCategoryUpdateReqDTO updateDTO) {
+ productCategoryManager.updateProductCategory(updateDTO);
+ return success(true);
+ }
+
+ @Override
+ public CommonResult deleteProductCategory(Integer productCategoryId) {
+ productCategoryManager.deleteProductCategory(productCategoryId);
+ return success(true);
+ }
+
+ @Override
+ public CommonResult getProductCategory(Integer productCategoryId) {
+ return success(productCategoryManager.getProductCategory(productCategoryId));
+ }
+
+ @Override
+ public CommonResult> listProductCategories(List productCategoryIds) {
+ return success(productCategoryManager.listProductCategories(productCategoryIds));
+ }
+
+ @Override
+ public CommonResult> listProductCategories(ProductCategoryListQueryReqDTO listQueryReqDTO) {
+ return success(productCategoryManager.listProductCategories(listQueryReqDTO));
+ }
+
+}
diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/ProductCategoryService.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/ProductCategoryService.java
index 722da2c55..ac862a4ee 100644
--- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/ProductCategoryService.java
+++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/ProductCategoryService.java
@@ -7,6 +7,7 @@ import cn.iocoder.mall.productservice.dal.mysql.mapper.category.ProductCategoryM
import cn.iocoder.mall.productservice.enums.category.ProductCategoryIdEnum;
import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryBO;
import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryCreateBO;
+import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryListQueryBO;
import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryUpdateBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -18,7 +19,7 @@ import java.util.List;
import static cn.iocoder.mall.productservice.enums.ProductErrorCodeConstants.*;
/**
-* 商品分类表 Service
+* 商品分类 Service
*/
@Service
@Validated
@@ -28,10 +29,10 @@ public class ProductCategoryService {
private ProductCategoryMapper productCategoryMapper;
/**
- * 创建商品分类表
+ * 创建商品分类
*
- * @param createBO 创建商品分类表 BO
- * @return 商品分类表
+ * @param createBO 创建商品分类 BO
+ * @return 商品分类
*/
public ProductCategoryBO createProductCategory(@Valid ProductCategoryCreateBO createBO) {
// 校验父分类
@@ -44,9 +45,9 @@ public class ProductCategoryService {
}
/**
- * 更新商品分类表
+ * 更新商品分类
*
- * @param updateBO 更新商品分类表 BO
+ * @param updateBO 更新商品分类 BO
*/
public void updateProductCategory(@Valid ProductCategoryUpdateBO updateBO) {
// 校验父分类
@@ -55,7 +56,7 @@ public class ProductCategoryService {
if (updateBO.getId().equals(updateBO.getPid())) {
throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_PARENT_NOT_SELF);
}
- // 校验更新的商品分类表是否存在
+ // 校验更新的商品分类是否存在
if (productCategoryMapper.selectById(updateBO.getId()) == null) {
throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_NOT_EXISTS);
}
@@ -65,12 +66,12 @@ public class ProductCategoryService {
}
/**
- * 删除商品分类表
+ * 删除商品分类
*
- * @param productCategoryId 商品分类表编号
+ * @param productCategoryId 商品分类编号
*/
public void deleteProductCategory(Integer productCategoryId) {
- // 校验删除的商品分类表是否存在
+ // 校验删除的商品分类是否存在
if (productCategoryMapper.selectById(productCategoryId) == null) {
throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_NOT_EXISTS);
}
@@ -85,10 +86,10 @@ public class ProductCategoryService {
}
/**
- * 获得商品分类表
+ * 获得商品分类
*
- * @param productCategoryId 商品分类表编号
- * @return 商品分类表
+ * @param productCategoryId 商品分类编号
+ * @return 商品分类
*/
public ProductCategoryBO getProductCategory(Integer productCategoryId) {
ProductCategoryDO productCategoryDO = productCategoryMapper.selectById(productCategoryId);
@@ -96,16 +97,26 @@ public class ProductCategoryService {
}
/**
- * 获得商品分类表列表
+ * 获得商品分类列表
*
- * @param productCategoryIds 商品分类表编号列表
- * @return 商品分类表列表
+ * @param productCategoryIds 商品分类编号列表
+ * @return 商品分类列表
*/
public List listProductCategories(List productCategoryIds) {
List productCategoryDOs = productCategoryMapper.selectBatchIds(productCategoryIds);
return ProductCategoryConvert.INSTANCE.convertList(productCategoryDOs);
}
+ /**
+ * 获得商品分类全列表
+ *
+ * @return 商品分类全列表
+ */
+ public List listProductCategories(ProductCategoryListQueryBO listQueryBO) {
+ List resourceDOs = productCategoryMapper.selectList(listQueryBO);
+ return ProductCategoryConvert.INSTANCE.convertList(resourceDOs);
+ }
+
private void validParent(Integer pid) {
if (!ProductCategoryIdEnum.ROOT.getId().equals(pid)) {
ProductCategoryDO parentCategory = productCategoryMapper.selectById(pid);
@@ -120,10 +131,4 @@ public class ProductCategoryService {
}
}
-// @Override
-// public List getListByPid(Integer pid) {
-// List categoryList = productCategoryMapper.selectListByPidAndStatusOrderBySort(pid, ProductCategoryConstants.STATUS_ENABLE);
-// return ProductCategoryConvert.INSTANCE.convertToBO(categoryList);
-// }
-
}
diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryBO.java
index c09bb3719..c7fc7152f 100644
--- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryBO.java
+++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryBO.java
@@ -6,7 +6,7 @@ import lombok.experimental.Accessors;
import java.util.Date;
/**
-* 商品分类表 BO
+* 商品分类 BO
*/
@Data
@Accessors(chain = true)
diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryCreateBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryCreateBO.java
index d6b0610fb..82149482c 100644
--- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryCreateBO.java
+++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryCreateBO.java
@@ -7,7 +7,7 @@ import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
-* 商品分类表创建 BO
+* 商品分类创建 BO
*/
@Data
@Accessors(chain = true)
diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryListQueryBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryListQueryBO.java
new file mode 100644
index 000000000..c843eafaa
--- /dev/null
+++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryListQueryBO.java
@@ -0,0 +1,18 @@
+package cn.iocoder.mall.productservice.service.category.bo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 商品分类列表查询 BO
+ */
+@Data
+@Accessors(chain = true)
+public class ProductCategoryListQueryBO {
+
+ /**
+ * 父编号
+ */
+ private Integer pid;
+
+}
diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryUpdateBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryUpdateBO.java
index 5268602e3..45eb63f59 100644
--- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryUpdateBO.java
+++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryUpdateBO.java
@@ -7,7 +7,7 @@ import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
-* 商品分类表更新 BO
+* 商品分类更新 BO
*/
@Data
@Accessors(chain = true)
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/package-info.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/package-info.java
deleted file mode 100644
index 943d9070b..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * author: sin
- * time: 2020/5/3 8:31 下午
- */
-package cn.iocoder.mall.product.biz.bo;
\ No newline at end of file
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/config/DatabaseConfiguration.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/config/DatabaseConfiguration.java
deleted file mode 100644
index d2e6ca7ad..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/config/DatabaseConfiguration.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package cn.iocoder.mall.product.biz.config;
-
-import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
-import com.baomidou.mybatisplus.core.injector.ISqlInjector;
-import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
-
-@Configuration
-@MapperScan("cn.iocoder.mall.product.biz.dao") // 扫描对应的 Mapper 接口
-@EnableTransactionManagement(proxyTargetClass = true)
-// 启动事务管理。为什么使用 proxyTargetClass 参数,参见 https://blog.csdn.net/huang_550/article/details/76492600
-public class DatabaseConfiguration {
- @Bean
- public ISqlInjector sqlInjector() {
- return new DefaultSqlInjector(); // MyBatis Plus 逻辑删除
- }
-
- @Bean
- public PaginationInterceptor paginationInterceptor() {
- return new PaginationInterceptor(); // MyBatis Plus 分页插件
- }
-
-}
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/category/ProductCategoryConvert.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/category/ProductCategoryConvert.java
deleted file mode 100644
index 47d7fd2fa..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/category/ProductCategoryConvert.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package cn.iocoder.mall.product.biz.convert.category;
-
-import cn.iocoder.mall.product.biz.bo.category.ProductCategoryBO;
-import cn.iocoder.mall.product.biz.dataobject.category.ProductCategoryDO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO;
-import org.mapstruct.Mapper;
-import org.mapstruct.factory.Mappers;
-import java.util.List;
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 商品分类 - 服务层数据转换
- */
-@Mapper
-public interface ProductCategoryConvert {
-
- ProductCategoryConvert INSTANCE = Mappers.getMapper(ProductCategoryConvert.class);
-
- /**
- * 商品分类统一DO转BO
- * @param category
- * @return
- */
- ProductCategoryBO convertToBO(ProductCategoryDO category);
-
-
- /**
- * 商品分类列表 - DO转换BO {@link #convertToBO(ProductCategoryDO)}
- * @param category
- * @return
- */
- List convertToAllListBO(List category);
-
- /**
- * 新增商品分类 - DTO转换DO
- * @param productCategoryAddDTO
- * @return
- */
- ProductCategoryDO convertToDO(ProductCategoryAddDTO productCategoryAddDTO);
-
- /**
- * 更新商品分类 - DTO转换DO
- * @param productCategoryUpdateDTO
- * @return
- */
- ProductCategoryDO convertToDO(ProductCategoryUpdateDTO productCategoryUpdateDTO);
-
- /**
- * 更新商品分类状态 - DTO转换DO
- * @param productCategoryUpdateStatusDTO
- * @return
- */
- ProductCategoryDO convertToDO(ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO);
-
-}
\ No newline at end of file
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/package-info.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/package-info.java
deleted file mode 100644
index 7f8ec0164..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * author: sin
- * time: 2020/5/3 8:31 下午
- */
-package cn.iocoder.mall.product.biz.convert;
\ No newline at end of file
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/category/ProductCategoryMapper.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/category/ProductCategoryMapper.java
deleted file mode 100644
index 1dd557202..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/category/ProductCategoryMapper.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package cn.iocoder.mall.product.biz.dao.category;
-
-import cn.iocoder.mall.product.biz.dataobject.category.ProductCategoryDO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import org.springframework.stereotype.Repository;
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 商品分类数据持久层
- */
-@Repository
-public interface ProductCategoryMapper extends BaseMapper {
- /**
- * 查询商品分类的下一级子分类数量
- * @param productCategoryId
- * @return
- */
- default Integer selectChildCategoryCount(Integer productCategoryId) {
- return this.selectCount(
- Wrappers.lambdaQuery().eq(ProductCategoryDO::getPid, productCategoryId)
- );
- }
-}
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/package-info.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/package-info.java
deleted file mode 100644
index d6ee2fb59..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * author: sin
- * time: 2020/5/3 8:28 下午
- */
-package cn.iocoder.mall.product.biz.dao;
\ No newline at end of file
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/category/ProductCategoryDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/category/ProductCategoryDO.java
deleted file mode 100644
index 317684f5a..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/category/ProductCategoryDO.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package cn.iocoder.mall.product.biz.dataobject.category;
-
-import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-/**
- * 商品分类
- */
-@Data
-@Accessors(chain = true)
-@TableName("product_category")
-public class ProductCategoryDO extends DeletableDO {
-
- /**
- * 分类编号
- */
- private Integer id;
- /**
- * 父分类编号
- *
- * 如果不存在父级,则 pid = 0 。
- */
- private Integer pid;
- /**
- * 名称
- */
- private String name;
- /**
- * 描述
- */
- private String description;
- /**
- * 分类图片
- */
- private String picUrl;
- /**
- * 排序值
- */
- private Integer sort;
- /**
- * 状态
- *
- * 1-开启
- * 2-关闭
- */
- private Integer status;
-
-}
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/package-info.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/package-info.java
deleted file mode 100644
index a182cf975..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * author: sin
- * time: 2020/5/3 8:27 下午
- */
-package cn.iocoder.mall.product.biz.dataobject;
\ No newline at end of file
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryAddDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryAddDTO.java
deleted file mode 100644
index f997a9655..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryAddDTO.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package cn.iocoder.mall.product.biz.dto.category;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 商品分类 - 创建商品分类DTO
- */
-@Data
-@Accessors(chain = true)
-public class ProductCategoryAddDTO {
-
- /**
- * 管理员id
- */
- @NotNull(message = "管理员id不能为空")
- private Integer adminId;
-
- /**
- * 父分类编号
- */
- @NotNull(message = "父分类编号不能为空")
- private Integer pid;
- /**
- * 名称
- */
- @NotNull(message = "名称不能为空")
- private String name;
- /**
- * 描述
- */
- @NotNull(message = "描述不能为空")
- private String description;
- /**
- * 分类图片
- */
- private String picUrl;
- /**
- * 排序值
- */
- @NotNull(message = "排序值不能为空")
- private Integer sort;
-
-}
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryDeleteDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryDeleteDTO.java
deleted file mode 100644
index 0f48ee4ca..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryDeleteDTO.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package cn.iocoder.mall.product.biz.dto.category;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 商品分类 - 删除商品分类DTO
- */
-@Data
-@Accessors(chain = true)
-public class ProductCategoryDeleteDTO {
-
- /**
- * 管理员id
- */
- @NotNull(message = "管理员id不能为空")
- private Integer adminId;
- /**
- * 商品分类编号
- */
- @NotNull(message = "编号不能为空")
- private Integer id;
-
-}
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryUpdateDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryUpdateDTO.java
deleted file mode 100644
index e007878b0..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryUpdateDTO.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package cn.iocoder.mall.product.biz.dto.category;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 商品分类 - 更新商品分类DTO
- */
-@Data
-@Accessors(chain = true)
-public class ProductCategoryUpdateDTO {
-
- /**
- * 管理员id
- */
- @NotNull(message = "管理员id不能为空")
- private Integer adminId;
- /**
- * 编号
- */
- @NotNull(message = "编号不能为空")
- private Integer id;
- /**
- * 父分类编号
- */
- @NotNull(message = "父分类编号不能为空")
- private Integer pid;
- /**
- * 名称
- */
- @NotNull(message = "名称不能为空")
- private String name;
- /**
- * 描述
- */
- @NotNull(message = "描述不能为空")
- private String description;
- /**
- * 分类图片
- */
- private String picUrl;
- /**
- * 排序值
- */
- @NotNull(message = "描述不能为空")
- private Integer sort;
-
-}
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryUpdateStatusDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryUpdateStatusDTO.java
deleted file mode 100644
index 9bd7f57e7..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryUpdateStatusDTO.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package cn.iocoder.mall.product.biz.dto.category;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 商品分类 - 更新商品分类状态DTO
- */
-@Data
-@Accessors(chain = true)
-public class ProductCategoryUpdateStatusDTO {
-
- /**
- * 管理员id
- */
- @NotNull(message = "管理员id不能为空")
- private Integer adminId;
- /**
- * 商品分类编号
- */
- @NotNull(message = "编号不能为空")
- private Integer id;
- /**
- * 状态
- */
- @NotNull(message = "状态不能为空")
- private Integer status;
-
-}
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryService.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryService.java
deleted file mode 100644
index 124b4f00e..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryService.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package cn.iocoder.mall.product.biz.service.category;
-
-import cn.iocoder.mall.product.biz.bo.category.ProductCategoryBO;
-import cn.iocoder.mall.product.biz.dataobject.category.ProductCategoryDO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryDeleteDTO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO;
-import org.springframework.validation.annotation.Validated;
-
-import javax.validation.Valid;
-import java.util.List;
-
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 商品分类 - 服务层
- */
-@Validated
-public interface ProductCategoryService {
-
- /**
- * 获取所有商品分类
- *
- * @return
- */
- List getAllProductCategory();
-
- /**
- * 新增商品分类
- *
- * @param productCategoryAddDTO
- * @return
- */
- ProductCategoryBO addProductCategory(@Valid ProductCategoryAddDTO productCategoryAddDTO);
-
- /**
- * 更新商品分类
- *
- * @param productCategoryUpdateDTO
- * @return
- */
- Boolean updateProductCategory(@Valid ProductCategoryUpdateDTO productCategoryUpdateDTO);
-
- /**
- * 更新商品分类状态
- *
- * @param productCategoryUpdateStatusDTO
- * @return
- */
- Boolean updateProductCategoryStatus(@Valid ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO);
-
- /**
- * 删除商品分类
- *
- * @param productCategoryDeleteDTO
- * @return
- */
- Boolean deleteProductCategory(@Valid ProductCategoryDeleteDTO productCategoryDeleteDTO);
-
- /**
- * 校验分类是否可用
- *
- * @param productCategoryId 分类ID
- * @return 商品分类
- */
- ProductCategoryDO validProductCategory(Integer productCategoryId);
-}
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryServiceImpl.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryServiceImpl.java
deleted file mode 100644
index 447f92d04..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryServiceImpl.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package cn.iocoder.mall.product.biz.service.category;
-
-import cn.iocoder.common.framework.util.ServiceExceptionUtil;
-import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
-import cn.iocoder.mall.product.biz.bo.category.ProductCategoryBO;
-import cn.iocoder.mall.product.biz.convert.category.ProductCategoryConvert;
-import cn.iocoder.mall.product.biz.dao.category.ProductCategoryMapper;
-import cn.iocoder.mall.product.biz.dataobject.category.ProductCategoryDO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryDeleteDTO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO;
-import cn.iocoder.mall.product.biz.enums.ProductErrorCodeEnum;
-import cn.iocoder.mall.product.biz.enums.category.ProductCategoryNodeEnum;
-import cn.iocoder.mall.product.biz.enums.category.ProductCategoryStatusEnum;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import static cn.iocoder.mall.product.biz.enums.ProductErrorCodeEnum.*;
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 商品分类 - 服务实现层
- */
-@Service
-public class ProductCategoryServiceImpl implements ProductCategoryService {
-
- @Autowired
- private ProductCategoryMapper productCategoryMapper;
-
- @Override
- public List getAllProductCategory() {
- List categoryList = productCategoryMapper.selectList(null);
- return ProductCategoryConvert.INSTANCE.convertToAllListBO(categoryList);
- }
-
-}
diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/package-info.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/package-info.java
deleted file mode 100644
index 4a008b3e1..000000000
--- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * author: sin
- * time: 2020/5/3 8:31 下午
- */
-package cn.iocoder.mall.product.biz.service;
\ No newline at end of file
diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/category/AdminsProductCategoryConvert.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/category/AdminsProductCategoryConvert.java
deleted file mode 100644
index 200119eab..000000000
--- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/category/AdminsProductCategoryConvert.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package cn.iocoder.mall.product.rest.convert.category;
-
-import cn.iocoder.mall.product.biz.bo.category.ProductCategoryBO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryDeleteDTO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO;
-import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO;
-import cn.iocoder.mall.product.rest.request.category.AdminsProductCategoryAddRequest;
-import cn.iocoder.mall.product.rest.request.category.AdminsProductCategoryUpdateRequest;
-import cn.iocoder.mall.product.rest.request.category.AdminsProductCategoryUpdateStatusRequest;
-import cn.iocoder.mall.product.rest.response.category.AdminsProductCategoryAddResponse;
-import cn.iocoder.mall.product.rest.response.category.AdminsProductCategoryTreeNodeResponse;
-import org.mapstruct.Mapper;
-import org.mapstruct.factory.Mappers;
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 管理员 - 商品分类 - API层数据转换
- */
-@Mapper
-public interface AdminsProductCategoryConvert {
-
- AdminsProductCategoryConvert INSTANCE = Mappers.getMapper(AdminsProductCategoryConvert.class);
-
- /**
- * 商品分类列表 - BO转换Response
- * @param productCategoryAllListBO
- * @return
- */
- AdminsProductCategoryTreeNodeResponse convertToTreeNodeResponse(ProductCategoryBO productCategoryAllListBO);
-
-
- /**
- * 新增商品分类 - Request转DTO
- * @param adminsProductCategoryAddRequest
- * @return
- */
- ProductCategoryAddDTO convertToAddDTO(Integer adminId, AdminsProductCategoryAddRequest adminsProductCategoryAddRequest);
-
- /**
- * 新增商品分类 - BO转Response
- * @param productCategoryAddBO
- * @return
- */
- AdminsProductCategoryAddResponse convertToAddResponse(ProductCategoryBO productCategoryAddBO);
-
- /**
- * 更新商品分类 - Request转DTO
- * @param adminsProductCategoryUpdateRequest
- * @return
- */
- ProductCategoryUpdateDTO convertToUpdateDTO(Integer adminId, AdminsProductCategoryUpdateRequest adminsProductCategoryUpdateRequest);
-
- /**
- * 更新商品分类状态 - Request转DTO
- * @param adminsProductCategoryUpdateStatusRequest
- * @return
- */
- ProductCategoryUpdateStatusDTO convertToUpdateStatusDTO(Integer adminId, AdminsProductCategoryUpdateStatusRequest adminsProductCategoryUpdateStatusRequest);
-
- /**
- * 删除商品分类 - Request转DTO
- * @param adminId 管理员id
- * @param id 商品分类id
- * @return
- */
- ProductCategoryDeleteDTO convertToDeleteDTO(Integer adminId, Integer id);
-}
diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryAddRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryAddRequest.java
deleted file mode 100644
index 65e9e4cfe..000000000
--- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryAddRequest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package cn.iocoder.mall.product.rest.request.category;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 管理员 - 商品分类 - 创建商品分类Request
- */
-@ApiModel("创建商品分类Request")
-@Data
-@Accessors(chain = true)
-public class AdminsProductCategoryAddRequest {
-
- @ApiModelProperty(name = "pid", value = "父级分类编号", required = true, example = "1")
- @NotNull(message = "父分类编号不能为空")
- private Integer pid;
-
- @ApiModelProperty(name = "name", value = "分类名字(标识)", required = true, example = "admin/info")
- @NotNull(message = "名称不能为空")
- private String name;
-
- @ApiModelProperty(name = "description", value = "描述", required = true, example = "1")
- @NotNull(message = "描述不能为空")
- private String description;
-
- @ApiModelProperty(name = "picUrl", value = "分类图片", example = "http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg/")
- private String picUrl;
-
- @ApiModelProperty(name = "sort", value = "排序", required = true, example = "1")
- @NotNull(message = "排序值不能为空")
- private Integer sort;
-}
diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateRequest.java
deleted file mode 100644
index c16e4abbf..000000000
--- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateRequest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package cn.iocoder.mall.product.rest.request.category;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 管理员 - 商品分类 - 更新商品分类Request
- */
-@ApiModel("更新商品分类Request")
-@Data
-@Accessors(chain = true)
-public class AdminsProductCategoryUpdateRequest {
-
- @ApiModelProperty(name = "id", value = "分类编号", required = true, example = "1")
- @NotNull(message = "编号不能为空")
- private Integer id;
-
- @ApiModelProperty(name = "pid", value = "父级分类编号", required = true, example = "1")
- @NotNull(message = "父分类编号不能为空")
- private Integer pid;
-
- @ApiModelProperty(name = "name", value = "分类名字(标识)", required = true, example = "admin/info")
- @NotNull(message = "名称不能为空")
- private String name;
-
- @ApiModelProperty(name = "description", value = "描述", required = true, example = "1")
- @NotNull(message = "描述不能为空")
- private String description;
-
- @ApiModelProperty(name = "picUrl", value = "分类图片", example = "http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg/")
- private String picUrl;
-
- @ApiModelProperty(name = "sort", value = "排序", required = true, example = "1")
- @NotNull(message = "排序值不能为空")
- private Integer sort;
-}
diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateStatusRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateStatusRequest.java
deleted file mode 100644
index 82106b636..000000000
--- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateStatusRequest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package cn.iocoder.mall.product.rest.request.category;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @Author: jiangweifan
- * @Date: 2020/5/6
- * @Description: 管理员 - 商品分类 - 更新商品分类状态Request
- */
-@ApiModel("更新商品分类状态Request")
-@Data
-@Accessors(chain = true)
-public class AdminsProductCategoryUpdateStatusRequest {
-
- @ApiModelProperty(name = "id", value = "分类编号", required = true, example = "1")
- @NotNull(message = "编号不能为空")
- private Integer id;
-
- @ApiModelProperty(name = "status", value = "状态。1 - 开启;2 - 禁用", required = true, example = "1")
- @NotNull(message = "状态不能为空")
- private Integer status;
-}
diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/ResourceService.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/ResourceService.java
index 64ef9c91c..ce7998511 100644
--- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/ResourceService.java
+++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/ResourceService.java
@@ -122,9 +122,9 @@ public class ResourceService {
}
/**
- * 获得资源树结构
+ * 获得资源全列表
*
- * @return 资源树结构
+ * @return 资源全列表
*/
public List listResources() {
List resourceDOs = resourceMapper.selectList(null);