From 24f3e697b8edac62b4fd5e98ffa28dabea558ff1 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Sat, 25 Jul 2020 22:29:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=93=81=E7=89=8C=E7=9A=84?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=EF=BC=8C=E5=87=86=E5=A4=87=E5=92=8C=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E7=AE=A1=E7=90=86=E5=90=8E=E5=8F=B0=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/ProductBrandController.java | 82 ++++++++++++ .../vo/brand/ProductBrandCreateReqVO.java | 20 +++ .../vo/brand/ProductBrandPageReqVO.java | 19 +++ .../product/vo/brand/ProductBrandRespVO.java | 24 ++++ .../vo/brand/ProductBrandUpdateReqVO.java | 22 +++ .../vo/category/ProductCategoryRespVO.java | 2 +- .../convert/product/ProductBrandConvert.java | 34 +++++ .../manager/product/ProductBrandManager.java | 94 +++++++++++++ .../src/main/resources/application.yml | 2 + .../enums/ProductErrorCodeConstants.java | 6 +- .../rpc/brand/ProductBrandRpc.java | 63 +++++++++ .../brand/dto/ProductBrandCreateReqDTO.java | 36 +++++ .../rpc/brand/dto/ProductBrandPageReqDTO.java | 22 ++- .../rpc/brand/dto/ProductBrandRespDTO.java | 29 ++-- .../brand/dto/ProductBrandUpdateReqDTO.java | 41 ++++++ .../convert/brand/ProductBrandConvert.java | 45 +++++++ .../dataobject/brand/ProductBrandDO.java | 24 ++-- .../category/ProductCategoryDO.java | 4 +- .../mapper/brand/ProductBrandMapper.java | 25 ++++ .../manager/brand/ProductBrandManager.java | 86 ++++++++++++ .../rpc/brand/ProductBrandRpcImpl.java | 58 ++++++++ .../service/brand/ProductBrandService.java | 119 +++++++++++++++++ .../service/brand}/bo/ProductBrandBO.java | 28 ++-- .../brand/bo/ProductBrandCreateBO.java | 38 ++++++ .../service/brand/bo/ProductBrandPageBO.java | 27 ++++ .../brand/bo/ProductBrandUpdateBO.java | 43 ++++++ .../category/bo/ProductCategoryCreateBO.java | 3 + .../category/bo/ProductCategoryUpdateBO.java | 3 + .../src/main/resources/application.yaml | 2 + .../convert/brand/ProductBrandConvert.java | 35 ----- .../biz/dao/brand/ProductBrandMapper.java | 25 ---- .../biz/dto/brand/ProductBrandAddDTO.java | 43 ------ .../biz/dto/brand/ProductBrandUpdateDTO.java | 49 ------- .../service/brand/ProductBrandService.java | 45 ------- .../brand/ProductBrandServiceImpl.java | 66 --------- .../AdminsProductCategoryController.java | 110 --------------- .../request/brand/ProductBrandAddRequest.java | 27 ---- .../brand/ProductBrandPageRequest.java | 24 ---- .../brand/ProductBrandUpdateRequest.java | 32 ----- .../AdminsProductCategoryAddResponse.java | 43 ------ ...AdminsProductCategoryTreeNodeResponse.java | 48 ------- .../product-rest/src/main/resources/rest.yaml | 12 -- .../mall/product/rpc/package-info.java | 4 - .../mall/product/rpc/package-info.java | 4 - .../src/main/resources/rpc-local.yaml | 14 -- .../src/main/resources/rpc-test.yaml | 14 -- .../product-rpc/src/main/resources/rpc.yaml | 22 --- .../mall/product/api/ProductBrandService.java | 40 ------ .../product/api/ProductCategoryService.java | 42 ------ .../product/api/bo/ProductBrangPageBO.java | 25 ---- .../api/constant/ProductAttrConstants.java | 23 ---- .../constant/ProductCategoryConstants.java | 19 --- .../api/constant/ProductErrorCodeEnum.java | 54 -------- .../api/constant/ProductSpuConstants.java | 14 -- .../product/api/dto/ProductBrandAddDTO.java | 43 ------ .../product/api/dto/ProductBrandPageDTO.java | 36 ----- .../api/dto/ProductBrandUpdateDTO.java | 49 ------- .../api/dto/ProductCategoryAddDTO.java | 41 ------ .../api/dto/ProductCategoryUpdateDTO.java | 46 ------- .../product/config/DatabaseConfiguration.java | 12 -- .../config/ServiceExceptionConfiguration.java | 26 ---- .../product/convert/ProductBrandConvert.java | 30 ----- .../convert/ProductCategoryConvert.java | 30 ----- .../mall/product/dao/ProductBrandMapper.java | 65 --------- .../product/dao/ProductCategoryMapper.java | 26 ---- .../product/dataobject/ProductBrandDO.java | 41 ------ .../product/dataobject/ProductCategoryDO.java | 48 ------- .../service/ProductBrandServiceImpl.java | 95 ------------- .../resources/mapper/ProductBrandMapper.xml | 95 ------------- .../mapper/ProductCategoryMapper.xml | 84 ------------ .../application/ProductApplication.java | 26 ---- .../admins/AdminsProductBrandController.java | 113 ---------------- .../AdminsProductCategoryController.java | 126 ------------------ .../convert/ProductBrandConvert.java | 22 --- .../convert/ProductCategoryConvert.java | 41 ------ .../vo/admins/AdminsProductBrandVO.java | 38 ------ .../vo/admins/AdminsProductBrangPageVO.java | 25 ---- .../AdminsProductCategoryTreeNodeVO.java | 35 ----- .../vo/admins/AdminsProductCategoryVO.java | 32 ----- .../src/main/resources/application-test.yaml | 6 - .../src/main/resources/application.yaml | 34 ----- 81 files changed, 931 insertions(+), 2169 deletions(-) create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandCreateReqVO.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandPageReqVO.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandRespVO.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandUpdateReqVO.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductBrandConvert.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductBrandManager.java create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpc.java create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandCreateReqDTO.java rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandPageDTO.java => product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandPageReqDTO.java (52%) rename product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductCategoryBO.java => product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandRespDTO.java (52%) create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandUpdateReqDTO.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/brand/ProductBrandConvert.java rename {product/product-biz/src/main/java/cn/iocoder/mall/product/biz => product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql}/dataobject/brand/ProductBrandDO.java (60%) create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/brand/ProductBrandMapper.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/brand/ProductBrandManager.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpcImpl.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/ProductBrandService.java rename {product/product-service-api/src/main/java/cn/iocoder/mall/product/api => product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand}/bo/ProductBrandBO.java (53%) create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandCreateBO.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandPageBO.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandUpdateBO.java delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/brand/ProductBrandConvert.java delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/brand/ProductBrandMapper.java delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandAddDTO.java delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandUpdateDTO.java delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandService.java delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java delete mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/category/AdminsProductCategoryController.java delete mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandAddRequest.java delete mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandPageRequest.java delete mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandUpdateRequest.java delete mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryAddResponse.java delete mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryTreeNodeResponse.java delete mode 100644 product/product-rest/src/main/resources/rest.yaml delete mode 100644 product/product-rpc-api/src/main/java/cn/iocoder/mall/product/rpc/package-info.java delete mode 100644 product/product-rpc/src/main/java/cn/iocoder/mall/product/rpc/package-info.java delete mode 100644 product/product-rpc/src/main/resources/rpc-local.yaml delete mode 100644 product/product-rpc/src/main/resources/rpc-test.yaml delete mode 100644 product/product-rpc/src/main/resources/rpc.yaml delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductBrandService.java delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductCategoryService.java delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductBrangPageBO.java delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductAttrConstants.java delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductCategoryConstants.java delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductErrorCodeEnum.java delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductSpuConstants.java delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandAddDTO.java delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandPageDTO.java delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandUpdateDTO.java delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryAddDTO.java delete mode 100644 product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryUpdateDTO.java delete mode 100644 product/product-service-impl/src/main/java/cn/iocoder/mall/product/config/DatabaseConfiguration.java delete mode 100644 product/product-service-impl/src/main/java/cn/iocoder/mall/product/config/ServiceExceptionConfiguration.java delete mode 100644 product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductBrandConvert.java delete mode 100644 product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductCategoryConvert.java delete mode 100644 product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductBrandMapper.java delete mode 100644 product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductCategoryMapper.java delete mode 100644 product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductBrandDO.java delete mode 100644 product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java delete mode 100644 product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductBrandServiceImpl.java delete mode 100644 product/product-service-impl/src/main/resources/mapper/ProductBrandMapper.xml delete mode 100644 product/product-service-impl/src/main/resources/mapper/ProductCategoryMapper.xml delete mode 100644 product/product-start/src/main/java/cn/iocoder/mall/product/application/ProductApplication.java delete mode 100644 product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductBrandController.java delete mode 100644 product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductCategoryController.java delete mode 100644 product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductBrandConvert.java delete mode 100644 product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductCategoryConvert.java delete mode 100644 product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductBrandVO.java delete mode 100644 product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductBrangPageVO.java delete mode 100644 product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductCategoryTreeNodeVO.java delete mode 100644 product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductCategoryVO.java delete mode 100644 product/product-start/src/main/resources/application-test.yaml delete mode 100644 product/product-start/src/main/resources/application.yaml diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.java new file mode 100644 index 000000000..f99a3ece9 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.java @@ -0,0 +1,82 @@ +package cn.iocoder.mall.managementweb.controller.product; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO; +import cn.iocoder.mall.managementweb.manager.product.ProductBrandManager; +import cn.iocoder.security.annotations.RequiresPermissions; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +import static cn.iocoder.common.framework.vo.CommonResult.success; + +/** +* 商品品牌 Controller +*/ +@RestController +@RequestMapping("/product-brand") +@Api(tags = "商品品牌") +@Validated +public class ProductBrandController { + + @Autowired + private ProductBrandManager productBrandManager; + + @PostMapping("/create") + @ApiOperation("创建商品品牌") + @RequiresPermissions("product:brand:create") + public CommonResult createProductBrand(@Valid ProductBrandCreateReqVO createVO) { + return success(productBrandManager.createProductBrand(createVO)); + } + + @PostMapping("/update") + @ApiOperation("更新商品品牌") + @RequiresPermissions("product:brand:update") + public CommonResult updateProductBrand(@Valid ProductBrandUpdateReqVO updateVO) { + productBrandManager.updateProductBrand(updateVO); + return success(true); + } + + @PostMapping("/delete") + @ApiOperation("删除商品品牌") + @ApiImplicitParam(name = "productBrandId", value = "商品品牌编号", required = true) + @RequiresPermissions("product:brand:delete") + public CommonResult deleteProductBrand(@RequestParam("productBrandId") Integer productBrandId) { + productBrandManager.deleteProductBrand(productBrandId); + return success(true); + } + + @GetMapping("/get") + @ApiOperation("获得商品品牌") + @ApiImplicitParam(name = "productBrandId", value = "商品品牌编号", required = true) + @RequiresPermissions("product:brand:page") + public CommonResult getProductBrand(@RequestParam("productBrandId") Integer productBrandId) { + return success(productBrandManager.getProductBrand(productBrandId)); + } + + @GetMapping("/list") + @ApiOperation("获得商品品牌列表") + @ApiImplicitParam(name = "productBrandIds", value = "商品品牌编号列表", required = true) + @RequiresPermissions("product:brand:page") + public CommonResult> listProductBrands(@RequestParam("productBrandIds") List productBrandIds) { + return success(productBrandManager.listProductBrands(productBrandIds)); + } + + @GetMapping("/page") + @ApiOperation("获得商品品牌分页") + @RequiresPermissions("product:brand:page") + public CommonResult> pageProductBrand(ProductBrandPageReqVO pageVO) { + return success(productBrandManager.pageProductBrand(pageVO)); + } + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandCreateReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandCreateReqVO.java new file mode 100644 index 000000000..0c4d8a42e --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandCreateReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.mall.managementweb.controller.product.vo.brand; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@ApiModel("商品品牌创建 Request VO") +@Data +public class ProductBrandCreateReqVO { + + @ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊") + private String name; + @ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊") + private String description; + @ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg") + private String picUrl; + @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/brand/ProductBrandPageReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandPageReqVO.java new file mode 100644 index 000000000..9bc34ed58 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandPageReqVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.mall.managementweb.controller.product.vo.brand; + +import cn.iocoder.common.framework.vo.PageParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@ApiModel("商品品牌分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class ProductBrandPageReqVO extends PageParam { + + @ApiModelProperty(value = "品牌名称", required = true, notes = "模糊匹配", example = "这个商品品牌很吊") + private String name; + @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/brand/ProductBrandRespVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandRespVO.java new file mode 100644 index 000000000..276a23651 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandRespVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.mall.managementweb.controller.product.vo.brand; + +import lombok.*; +import io.swagger.annotations.*; +import java.util.*; + +@ApiModel("商品品牌 Response VO") +@Data +public class ProductBrandRespVO { + + @ApiModelProperty(value = "品牌编号", required = true, example = "1024") + private Integer id; + @ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊") + private String name; + @ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊") + private String description; + @ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg") + private String picUrl; + @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") + private Integer status; + @ApiModelProperty(value = "创建时间", required = true) + private Date createTime; + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandUpdateReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandUpdateReqVO.java new file mode 100644 index 000000000..eb9352ff5 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandUpdateReqVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.mall.managementweb.controller.product.vo.brand; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@ApiModel("商品品牌更新 Request VO") +@Data +public class ProductBrandUpdateReqVO { + + @ApiModelProperty(value = "品牌编号", required = true, example = "1024") + private Integer id; + @ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊") + private String name; + @ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊") + private String description; + @ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg") + private String picUrl; + @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/ProductCategoryRespVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryRespVO.java index 3f50c1534..4b9c287c1 100644 --- 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 @@ -16,7 +16,7 @@ public class ProductCategoryRespVO { private Integer pid; @ApiModelProperty(value = "分类名称", required = true, example = "手机") private String name; - @ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊") + @ApiModelProperty(value = "分类描述", required = true, example = "这个商品分类很吊") private String description; @ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg") private String picUrl; diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductBrandConvert.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductBrandConvert.java new file mode 100644 index 000000000..476898156 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductBrandConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.mall.managementweb.convert.product; + +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface ProductBrandConvert { + + ProductBrandConvert INSTANCE = Mappers.getMapper(ProductBrandConvert.class); + + ProductBrandCreateReqDTO convert(ProductBrandCreateReqVO bean); + + ProductBrandUpdateReqDTO convert(ProductBrandUpdateReqVO bean); + + ProductBrandRespVO convert(ProductBrandRespDTO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + ProductBrandPageReqDTO convert(ProductBrandPageReqVO bean); + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductBrandManager.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductBrandManager.java new file mode 100644 index 000000000..a704dece4 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductBrandManager.java @@ -0,0 +1,94 @@ +package cn.iocoder.mall.managementweb.manager.product; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO; +import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO; +import cn.iocoder.mall.managementweb.convert.product.ProductBrandConvert; +import cn.iocoder.mall.productservice.rpc.brand.ProductBrandRpc; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; +import org.apache.dubbo.config.annotation.Reference; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* 商品品牌 Manager +*/ +@Service +public class ProductBrandManager { + + @Reference(version = "${dubbo.consumer.ProductBrandRpc.version}") + private ProductBrandRpc productBrandRpc; + + /** + * 创建商品品牌 + * + * @param createVO 创建商品品牌 VO + * @return 商品品牌 + */ + public Integer createProductBrand(ProductBrandCreateReqVO createVO) { + CommonResult createProductBrandResult = productBrandRpc.createProductBrand(ProductBrandConvert.INSTANCE.convert(createVO)); + createProductBrandResult.checkError(); + return createProductBrandResult.getData(); + } + + /** + * 更新商品品牌 + * + * @param updateVO 更新商品品牌 VO + */ + public void updateProductBrand(ProductBrandUpdateReqVO updateVO) { + CommonResult updateProductBrandResult = productBrandRpc.updateProductBrand(ProductBrandConvert.INSTANCE.convert(updateVO)); + updateProductBrandResult.checkError(); + } + + /** + * 删除商品品牌 + * + * @param productBrandId 商品品牌编号 + */ + public void deleteProductBrand(Integer productBrandId) { + CommonResult deleteProductBrandResult = productBrandRpc.deleteProductBrand(productBrandId); + deleteProductBrandResult.checkError(); + } + + /** + * 获得商品品牌 + * + * @param productBrandId 商品品牌编号 + * @return 商品品牌 + */ + public ProductBrandRespVO getProductBrand(Integer productBrandId) { + CommonResult getProductBrandResult = productBrandRpc.getProductBrand(productBrandId); + getProductBrandResult.checkError(); + return ProductBrandConvert.INSTANCE.convert(getProductBrandResult.getData()); + } + + /** + * 获得商品品牌列表 + * + * @param productBrandIds 商品品牌编号列表 + * @return 商品品牌列表 + */ + public List listProductBrands(List productBrandIds) { + CommonResult> listProductBrandResult = productBrandRpc.listProductBrands(productBrandIds); + listProductBrandResult.checkError(); + return ProductBrandConvert.INSTANCE.convertList(listProductBrandResult.getData()); + } + + /** + * 获得商品品牌分页 + * + * @param pageVO 商品品牌分页查询 + * @return 商品品牌分页结果 + */ + public PageResult pageProductBrand(ProductBrandPageReqVO pageVO) { + CommonResult> pageProductBrandResult = productBrandRpc.pageProductBrand(ProductBrandConvert.INSTANCE.convert(pageVO)); + pageProductBrandResult.checkError(); + return ProductBrandConvert.INSTANCE.convertPage(pageProductBrandResult.getData()); + } + +} diff --git a/management-web-app/src/main/resources/application.yml b/management-web-app/src/main/resources/application.yml index 181ad02bc..08e950052 100644 --- a/management-web-app/src/main/resources/application.yml +++ b/management-web-app/src/main/resources/application.yml @@ -51,6 +51,8 @@ dubbo: version: 1.0.0 ProductCategoryRpc: version: 1.0.0 + ProductBrandRpc: + version: 1.0.0 # Swagger 配置项 swagger: diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/ProductErrorCodeConstants.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/ProductErrorCodeConstants.java index 90f638270..5aaa28b20 100644 --- a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/ProductErrorCodeConstants.java +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/ProductErrorCodeConstants.java @@ -12,10 +12,7 @@ public interface ProductErrorCodeConstants { // ========== PRODUCT CATEGORY 模块 ========== ErrorCode PRODUCT_CATEGORY_PARENT_NOT_EXISTS = new ErrorCode(1003001000, "父分类不存在"); ErrorCode PRODUCT_CATEGORY_NOT_EXISTS = new ErrorCode(1003001001, "商品分类不存在"); - ErrorCode PRODUCT_CATEGORY_STATUS_NOT_EXISTS = new ErrorCode(1003001001, "商品分类状态不存在"); ErrorCode PRODUCT_CATEGORY_PARENT_NOT_SELF = new ErrorCode(1003001002, "不能设置自己为父分类"); - ErrorCode PRODUCT_CATEGORY_STATUS_EQUALS = new ErrorCode(1002001003, "商品分类已经是该状态"); - ErrorCode PRODUCT_CATEGORY_DELETE_ONLY_DISABLE = new ErrorCode(1002001004, "只有关闭的商品分类才可以删除"); ErrorCode PRODUCT_CATEGORY_DELETE_ONLY_NO_CHILD = new ErrorCode(1002001004, "只有无子分类的商品分类才可以删除"); ErrorCode PRODUCT_CATEGORY_MUST_ENABLE = new ErrorCode(1002001005, "只有开启的商品分类,才可以使用"); ErrorCode PRODUCT_CATEGORY_PARENT_CAN_NOT_BE_LEVEL2 = new ErrorCode(1002001005, "父分类必须是一级分类"); @@ -36,6 +33,7 @@ public interface ProductErrorCodeConstants { ErrorCode PRODUCT_ATTR_VALUE_STATUS_EQUALS = new ErrorCode(1003003005, "商品规格值已经是该状态"); // ========== PRODUCT BRAND模块 ========== - ErrorCode PRODUCT_BRAND_EXIST = new ErrorCode(1003004000,"品牌值已经存在"); + ErrorCode PRODUCT_BRAND_NAME_EXIST = new ErrorCode(1003004000,"商品品牌的名字已经存在"); + ErrorCode PRODUCT_BRAND_NOT_FOUND = new ErrorCode(1003004001, "商品品牌不粗糙你在"); } diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpc.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpc.java new file mode 100644 index 000000000..3e62a022b --- /dev/null +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpc.java @@ -0,0 +1,63 @@ +package cn.iocoder.mall.productservice.rpc.brand; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO; + +import java.util.List; + +/** +* 商品品牌 Rpc 接口 +*/ +public interface ProductBrandRpc { + + /** + * 创建商品品牌 + * + * @param createDTO 创建商品品牌 DTO + * @return 商品品牌编号 + */ + CommonResult createProductBrand(ProductBrandCreateReqDTO createDTO); + + /** + * 更新商品品牌 + * + * @param updateDTO 更新商品品牌 DTO + */ + CommonResult updateProductBrand(ProductBrandUpdateReqDTO updateDTO); + + /** + * 删除商品品牌 + * + * @param productBrandId 商品品牌编号 + */ + CommonResult deleteProductBrand(Integer productBrandId); + + /** + * 获得商品品牌 + * + * @param productBrandId 商品品牌编号 + * @return 商品品牌 + */ + CommonResult getProductBrand(Integer productBrandId); + + /** + * 获得商品品牌列表 + * + * @param productBrandIds 商品品牌编号列表 + * @return 商品品牌列表 + */ + CommonResult> listProductBrands(List productBrandIds); + + /** + * 获得商品品牌分页 + * + * @param pageDTO 商品品牌分页查询 + * @return 商品品牌分页结果 + */ + CommonResult> pageProductBrand(ProductBrandPageReqDTO pageDTO); + +} diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandCreateReqDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandCreateReqDTO.java new file mode 100644 index 000000000..c8d6971e1 --- /dev/null +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandCreateReqDTO.java @@ -0,0 +1,36 @@ +package cn.iocoder.mall.productservice.rpc.brand.dto; + +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 ProductBrandCreateReqDTO implements Serializable { + + /** + * 品牌名称 + */ + @NotEmpty(message = "品牌名称不能为空") + private String name; + /** + * 品牌描述 + */ + private String description; + /** + * 品牌名图片 + */ + private String picUrl; + /** + * 状态 + */ + @NotNull(message = "状态不能为空") + private Integer status; + +} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandPageDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandPageReqDTO.java similarity index 52% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandPageDTO.java rename to product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandPageReqDTO.java index 63255b5ef..bb56f1b23 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandPageDTO.java +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandPageReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dto.brand; +package cn.iocoder.mall.productservice.rpc.brand.dto; import cn.iocoder.common.framework.vo.PageParam; import lombok.Data; @@ -6,26 +6,20 @@ import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** - * 商品品牌分页 DTO - */ +* 商品品牌分页 Request DTO +*/ @Data @EqualsAndHashCode(callSuper = true) @Accessors(chain = true) -public class ProductBrandPageDTO extends PageParam { +public class ProductBrandPageReqDTO extends PageParam { /** - * 名称 - */ + * 品牌名称 + */ private String name; - /** - * 描述 - */ - private String description; - - /** - * 状态 1-开启 2-禁用 - */ + * 状态 + */ private Integer status; } diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductCategoryBO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandRespDTO.java similarity index 52% rename from product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductCategoryBO.java rename to product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandRespDTO.java index b2cefd507..feaf58fcd 100644 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductCategoryBO.java +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.api.bo; +package cn.iocoder.mall.productservice.rpc.brand.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -7,43 +7,30 @@ import java.io.Serializable; import java.util.Date; /** - * 商品分类 BO - */ +* 商品品牌 Response DTO +*/ @Data @Accessors(chain = true) -public class ProductCategoryBO implements Serializable { +public class ProductBrandRespDTO implements Serializable { /** - * 分类编号 + * 品牌编号(主键) */ 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-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandUpdateReqDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandUpdateReqDTO.java new file mode 100644 index 000000000..d940a9103 --- /dev/null +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandUpdateReqDTO.java @@ -0,0 +1,41 @@ +package cn.iocoder.mall.productservice.rpc.brand.dto; + +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 ProductBrandUpdateReqDTO implements Serializable { + + /** + * 品牌编号 + */ + @NotNull(message = "品牌编号不能为空") + private Integer id; + /** + * 品牌名称 + */ + @NotEmpty(message = "品牌名称不能为空") + private String name; + /** + * 品牌描述 + */ + private String description; + /** + * 品牌名图片 + */ + private String picUrl; + /** + * 状态 + */ + @NotNull(message = "状态不能为空") + private Integer status; + +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/brand/ProductBrandConvert.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/brand/ProductBrandConvert.java new file mode 100644 index 000000000..c81dd9e3d --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/brand/ProductBrandConvert.java @@ -0,0 +1,45 @@ +package cn.iocoder.mall.productservice.convert.brand; + +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.productservice.dal.mysql.dataobject.brand.ProductBrandDO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO; +import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandBO; +import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandCreateBO; +import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandPageBO; +import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandUpdateBO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface ProductBrandConvert { + + ProductBrandConvert INSTANCE = Mappers.getMapper(ProductBrandConvert.class); + + ProductBrandDO convert(ProductBrandCreateBO bean); + + ProductBrandBO convert(ProductBrandDO bean); + + ProductBrandDO convert(ProductBrandUpdateBO bean); + + List convertList(List list); + + PageResult convertPage(IPage page); + + ProductBrandCreateBO convert(ProductBrandCreateReqDTO bean); + + ProductBrandUpdateBO convert(ProductBrandUpdateReqDTO bean); + + ProductBrandRespDTO convert(ProductBrandBO bean); + + List convertList02(List list); + + ProductBrandPageBO convert(ProductBrandPageReqDTO bean); + + PageResult convertPage(PageResult page); +} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/brand/ProductBrandDO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/brand/ProductBrandDO.java similarity index 60% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/brand/ProductBrandDO.java rename to product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/brand/ProductBrandDO.java index 01b47a3a2..0e489cbf6 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/brand/ProductBrandDO.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/brand/ProductBrandDO.java @@ -1,42 +1,40 @@ -package cn.iocoder.mall.product.biz.dataobject.brand; +package cn.iocoder.mall.productservice.dal.mysql.dataobject.brand; import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** - * Product 品牌 - */ +* 商品品牌 +*/ +@TableName("product_brand") @Data @EqualsAndHashCode(callSuper = true) @Accessors(chain = true) public class ProductBrandDO extends DeletableDO { /** - * 规格编号 + * 品牌编号(主键) */ + @TableId private Integer id; /** - * 名称 + * 品牌名称 */ private String name; - /** - * 描述 + * 品牌描述 */ private String description; - /** - * 图片地址 + * 品牌名图片 */ private String picUrl; - /** * 状态 - *

- * 1-开启 - * 2-禁用 */ private Integer status; 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 25e5f0a66..eba468822 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 @@ -1,7 +1,7 @@ package cn.iocoder.mall.productservice.dal.mysql.dataobject.category; import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -15,7 +15,7 @@ import lombok.experimental.Accessors; @Data @EqualsAndHashCode(callSuper = true) @Accessors(chain = true) -public class ProductCategoryDO extends BaseDO { +public class ProductCategoryDO extends DeletableDO { /** * 分类编号 diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/brand/ProductBrandMapper.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/brand/ProductBrandMapper.java new file mode 100644 index 000000000..538ffbb69 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/brand/ProductBrandMapper.java @@ -0,0 +1,25 @@ +package cn.iocoder.mall.productservice.dal.mysql.mapper.brand; + +import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; +import cn.iocoder.mall.productservice.dal.mysql.dataobject.brand.ProductBrandDO; +import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandPageBO; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.stereotype.Repository; + +@Repository +public interface ProductBrandMapper extends BaseMapper { + + default IPage selectPage(ProductBrandPageBO pageBO) { + return selectPage(new Page<>(pageBO.getPageNo(), pageBO.getPageSize()), + new QueryWrapperX().likeIfPresent("name", pageBO.getName()) + .eqIfPresent("status", pageBO.getStatus())); + } + + default ProductBrandDO selectByName(String name) { + return selectOne(new QueryWrapper().eq("name", name)); + } + +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/brand/ProductBrandManager.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/brand/ProductBrandManager.java new file mode 100644 index 000000000..5a586466d --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/brand/ProductBrandManager.java @@ -0,0 +1,86 @@ +package cn.iocoder.mall.productservice.manager.brand; + +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.productservice.convert.brand.ProductBrandConvert; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO; +import cn.iocoder.mall.productservice.service.brand.ProductBrandService; +import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandBO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* 商品品牌 Manager +*/ +@Service +public class ProductBrandManager { + + @Autowired + private ProductBrandService productBrandService; + + /** + * 创建商品品牌 + * + * @param createDTO 创建商品品牌 DTO + * @return 商品品牌 + */ + public Integer createProductBrand(ProductBrandCreateReqDTO createDTO) { + ProductBrandBO productBrandBO = productBrandService.createProductBrand(ProductBrandConvert.INSTANCE.convert(createDTO)); + return productBrandBO.getId(); + } + + /** + * 更新商品品牌 + * + * @param updateDTO 更新商品品牌 DTO + */ + public void updateProductBrand(ProductBrandUpdateReqDTO updateDTO) { + productBrandService.updateProductBrand(ProductBrandConvert.INSTANCE.convert(updateDTO)); + } + + /** + * 删除商品品牌 + * + * @param productBrandId 商品品牌编号 + */ + public void deleteProductBrand(Integer productBrandId) { + productBrandService.deleteProductBrand(productBrandId); + } + + /** + * 获得商品品牌 + * + * @param productBrandId 商品品牌编号 + * @return 商品品牌 + */ + public ProductBrandRespDTO getProductBrand(Integer productBrandId) { + ProductBrandBO productBrandBO = productBrandService.getProductBrand(productBrandId); + return ProductBrandConvert.INSTANCE.convert(productBrandBO); + } + + /** + * 获得商品品牌列表 + * + * @param productBrandIds 商品品牌编号列表 + * @return 商品品牌列表 + */ + public List listProductBrands(List productBrandIds) { + List productBrandBOs = productBrandService.listProductBrands(productBrandIds); + return ProductBrandConvert.INSTANCE.convertList02(productBrandBOs); + } + + /** + * 获得商品品牌分页 + * + * @param pageDTO 商品品牌分页查询 + * @return 商品品牌分页结果 + */ + public PageResult pageProductBrand(ProductBrandPageReqDTO pageDTO) { + PageResult pageResultBO = productBrandService.pageProductBrand(ProductBrandConvert.INSTANCE.convert(pageDTO)); + return ProductBrandConvert.INSTANCE.convertPage(pageResultBO); + } +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpcImpl.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpcImpl.java new file mode 100644 index 000000000..ada6bb285 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpcImpl.java @@ -0,0 +1,58 @@ +package cn.iocoder.mall.productservice.rpc.brand; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.productservice.manager.brand.ProductBrandManager; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; +import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO; +import org.apache.dubbo.config.annotation.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +import static cn.iocoder.common.framework.vo.CommonResult.success; + +/** +* 商品品牌 Rpc 实现类 +*/ +@Service(version = "${dubbo.provider.ProductBrandRpc.version}") +public class ProductBrandRpcImpl implements ProductBrandRpc { + + @Autowired + private ProductBrandManager productBrandManager; + + @Override + public CommonResult createProductBrand(ProductBrandCreateReqDTO createDTO) { + return success(productBrandManager.createProductBrand(createDTO)); + } + + @Override + public CommonResult updateProductBrand(ProductBrandUpdateReqDTO updateDTO) { + productBrandManager.updateProductBrand(updateDTO); + return success(true); + } + + @Override + public CommonResult deleteProductBrand(Integer productBrandId) { + productBrandManager.deleteProductBrand(productBrandId); + return success(true); + } + + @Override + public CommonResult getProductBrand(Integer productBrandId) { + return success(productBrandManager.getProductBrand(productBrandId)); + } + + @Override + public CommonResult> listProductBrands(List productBrandIds) { + return success(productBrandManager.listProductBrands(productBrandIds)); + } + + @Override + public CommonResult> pageProductBrand(ProductBrandPageReqDTO pageDTO) { + return success(productBrandManager.pageProductBrand(pageDTO)); + } + +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/ProductBrandService.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/ProductBrandService.java new file mode 100644 index 000000000..08a8ed357 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/ProductBrandService.java @@ -0,0 +1,119 @@ +package cn.iocoder.mall.productservice.service.brand; + +import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.productservice.convert.brand.ProductBrandConvert; +import cn.iocoder.mall.productservice.dal.mysql.dataobject.brand.ProductBrandDO; +import cn.iocoder.mall.productservice.dal.mysql.mapper.brand.ProductBrandMapper; +import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandBO; +import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandCreateBO; +import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandPageBO; +import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandUpdateBO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.List; + +import static cn.iocoder.mall.productservice.enums.ProductErrorCodeConstants.PRODUCT_BRAND_NAME_EXIST; +import static cn.iocoder.mall.productservice.enums.ProductErrorCodeConstants.PRODUCT_BRAND_NOT_FOUND; + +/** +* 商品品牌 Service +*/ +@Service +@Validated +public class ProductBrandService { + + @Autowired + private ProductBrandMapper productBrandMapper; + + /** + * 创建商品品牌 + * + * @param createBO 创建商品品牌 BO + * @return 商品品牌 + */ + public ProductBrandBO createProductBrand(@Valid ProductBrandCreateBO createBO) { + // 校验商品品牌的名字是否已经使用 + if (productBrandMapper.selectByName(createBO.getName()) != null) { + throw ServiceExceptionUtil.exception(PRODUCT_BRAND_NAME_EXIST); + } + // 插入到数据库 + ProductBrandDO productBrandDO = ProductBrandConvert.INSTANCE.convert(createBO); + productBrandMapper.insert(productBrandDO); + // 返回 + return ProductBrandConvert.INSTANCE.convert(productBrandDO); + } + + /** + * 更新商品品牌 + * + * @param updateBO 更新商品品牌 BO + */ + public void updateProductBrand(@Valid ProductBrandUpdateBO updateBO) { + // 校验更新的商品品牌是否存在 + if (productBrandMapper.selectById(updateBO.getId()) == null) { + throw ServiceExceptionUtil.exception(PRODUCT_BRAND_NOT_FOUND); + } + // 校验商品品牌的名字是否已经使用 + ProductBrandDO productBrandDOByName = productBrandMapper.selectByName(updateBO.getName()); + if (productBrandDOByName != null && !updateBO.getId().equals(productBrandDOByName.getId())) { + throw ServiceExceptionUtil.exception(PRODUCT_BRAND_NAME_EXIST); + } + // 更新到数据库 + ProductBrandDO updateObject = ProductBrandConvert.INSTANCE.convert(updateBO); + productBrandMapper.updateById(updateObject); + } + + /** + * 删除商品品牌 + * + * @param productBrandId 商品品牌编号 + */ + public void deleteProductBrand(Integer productBrandId) { + // 校验删除的商品品牌是否存在 + if (productBrandMapper.selectById(productBrandId) == null) { + throw ServiceExceptionUtil.exception(PRODUCT_BRAND_NOT_FOUND); + } + // TODO 功能点:需要品牌下没有分类 + // 标记删除 + productBrandMapper.deleteById(productBrandId); + } + + /** + * 获得商品品牌 + * + * @param productBrandId 商品品牌编号 + * @return 商品品牌 + */ + public ProductBrandBO getProductBrand(Integer productBrandId) { + ProductBrandDO productBrandDO = productBrandMapper.selectById(productBrandId); + return ProductBrandConvert.INSTANCE.convert(productBrandDO); + } + + /** + * 获得商品品牌列表 + * + * @param productBrandIds 商品品牌编号列表 + * @return 商品品牌列表 + */ + public List listProductBrands(List productBrandIds) { + List productBrandDOs = productBrandMapper.selectBatchIds(productBrandIds); + return ProductBrandConvert.INSTANCE.convertList(productBrandDOs); + } + + /** + * 获得商品品牌分页 + * + * @param pageBO 商品品牌分页查询 + * @return 商品品牌分页结果 + */ + public PageResult pageProductBrand(ProductBrandPageBO pageBO) { + IPage productBrandDOPage = productBrandMapper.selectPage(pageBO); + return ProductBrandConvert.INSTANCE.convertPage(productBrandDOPage); + } + +} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductBrandBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandBO.java similarity index 53% rename from product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductBrandBO.java rename to product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandBO.java index 691fb005e..1d16313e8 100644 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductBrandBO.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandBO.java @@ -1,42 +1,40 @@ -package cn.iocoder.mall.product.api.bo; +package cn.iocoder.mall.productservice.service.brand.bo; import lombok.Data; import lombok.experimental.Accessors; -import java.io.Serializable; +import java.util.Date; /** - * 商品品牌 VO - */ +* 商品品牌 BO +*/ @Data @Accessors(chain = true) -public class ProductBrandBO implements Serializable { +public class ProductBrandBO { /** - * 规格编号 + * 品牌编号(主键) */ private Integer id; /** - * 名称 + * 品牌名称 */ private String name; - /** - * 描述 + * 品牌描述 */ private String description; - /** - * 图片地址 + * 品牌名图片 */ private String picUrl; - /** * 状态 - * - * 1-开启 - * 2-禁用 */ private Integer status; + /** + * 创建时间 + */ + private Date createTime; } diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandCreateBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandCreateBO.java new file mode 100644 index 000000000..b66d9def3 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandCreateBO.java @@ -0,0 +1,38 @@ +package cn.iocoder.mall.productservice.service.brand.bo; + +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; + +/** +* 商品品牌创建 BO +*/ +@Data +@Accessors(chain = true) +public class ProductBrandCreateBO { + + /** + * 品牌名称 + */ + @NotEmpty(message = "品牌名称不能为空") + private String name; + /** + * 品牌描述 + */ + private String description; + /** + * 品牌名图片 + */ + private String picUrl; + /** + * 状态 + */ + @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/service/brand/bo/ProductBrandPageBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandPageBO.java new file mode 100644 index 000000000..bc727eff0 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandPageBO.java @@ -0,0 +1,27 @@ +package cn.iocoder.mall.productservice.service.brand.bo; + +import cn.iocoder.common.framework.vo.PageParam; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** +* 商品品牌分页 BO +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +public class ProductBrandPageBO extends PageParam { + + /** + * 品牌名称 + * + * 模糊匹配 + */ + private String name; + /** + * 状态 + */ + private Integer status; + +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandUpdateBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandUpdateBO.java new file mode 100644 index 000000000..ff6c59bc1 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandUpdateBO.java @@ -0,0 +1,43 @@ +package cn.iocoder.mall.productservice.service.brand.bo; + +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; + +/** +* 商品品牌更新 BO +*/ +@Data +@Accessors(chain = true) +public class ProductBrandUpdateBO { + + /** + * 品牌编号(主键) + */ + @NotNull(message = "品牌编号(主键)不能为空") + private Integer id; + /** + * 品牌名称 + */ + @NotEmpty(message = "品牌名称不能为空") + private String name; + /** + * 品牌描述 + */ + private String description; + /** + * 品牌名图片 + */ + private String picUrl; + /** + * 状态 + */ + @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/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 82149482c..b58aa3769 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 @@ -1,5 +1,7 @@ package cn.iocoder.mall.productservice.service.category.bo; +import cn.iocoder.common.framework.enums.CommonStatusEnum; +import cn.iocoder.common.framework.validator.InEnum; import lombok.Data; import lombok.experimental.Accessors; @@ -40,6 +42,7 @@ public class ProductCategoryCreateBO { * 状态 */ @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/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 45eb63f59..c32b43197 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 @@ -1,5 +1,7 @@ package cn.iocoder.mall.productservice.service.category.bo; +import cn.iocoder.common.framework.enums.CommonStatusEnum; +import cn.iocoder.common.framework.validator.InEnum; import lombok.Data; import lombok.experimental.Accessors; @@ -45,6 +47,7 @@ public class ProductCategoryUpdateBO { * 状态 */ @NotNull(message = "状态不能为空") + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") private Integer status; } diff --git a/product-service-project/product-service-app/src/main/resources/application.yaml b/product-service-project/product-service-app/src/main/resources/application.yaml index 8a7aff7e0..98e91e118 100644 --- a/product-service-project/product-service-app/src/main/resources/application.yaml +++ b/product-service-project/product-service-app/src/main/resources/application.yaml @@ -36,6 +36,8 @@ dubbo: validation: true # 开启 Provider 参数校验 ProductCategoryRpc: version: 1.0.0 + ProductBrandRpc: + verion: 1.0.0 # Dubbo 服务消费者的配置 consumer: ErrorCodeRpc: diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/brand/ProductBrandConvert.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/brand/ProductBrandConvert.java deleted file mode 100644 index e0784cdac..000000000 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/brand/ProductBrandConvert.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.iocoder.mall.product.biz.convert.brand; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO; -import cn.iocoder.mall.product.biz.dataobject.brand.ProductBrandDO; -import cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO; -import cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductBrandConvert { - - ProductBrandConvert INSTANCE = Mappers.getMapper(ProductBrandConvert.class); - - @Mapping(source = "records", target = "list") - PageResult convertPage(IPage bean); - - @Mappings({}) - List convert(List brands); - - @Mappings({}) - ProductBrandBO convert(ProductBrandDO brand); - - @Mappings({}) - ProductBrandDO convert(ProductBrandUpdateDTO brand); - - @Mappings({}) - ProductBrandDO convert(ProductBrandAddDTO brand); -} \ No newline at end of file diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/brand/ProductBrandMapper.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/brand/ProductBrandMapper.java deleted file mode 100644 index 9ba2513df..000000000 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/brand/ProductBrandMapper.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.mall.product.biz.dao.brand; - -import cn.iocoder.mall.product.biz.dataobject.brand.ProductBrandDO; -import cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Repository; - -@Repository -public interface ProductBrandMapper extends BaseMapper { - - default IPage selectPageByParams(ProductBrandPageDTO productBrandPageDTO) { - Page page = new Page<>(productBrandPageDTO.getPageNo(), productBrandPageDTO.getPageSize()); - LambdaQueryWrapper queryWrapper = Wrappers.query().lambda() - .like(StringUtils.isNotBlank(productBrandPageDTO.getName()), ProductBrandDO::getName, productBrandPageDTO.getName()) - .like(StringUtils.isNotBlank(productBrandPageDTO.getDescription()), ProductBrandDO::getName, productBrandPageDTO.getDescription()) - .eq(null != productBrandPageDTO.getStatus(), ProductBrandDO::getName, productBrandPageDTO.getStatus()) - .eq(ProductBrandDO::getDeleted, false); - return selectPage(page, queryWrapper); - } -} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandAddDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandAddDTO.java deleted file mode 100644 index 9b345eecd..000000000 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandAddDTO.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.mall.product.biz.dto.brand; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -/** - * Product 品牌添加 DTO - */ -@Data -@Accessors(chain = true) -public class ProductBrandAddDTO { - - /** - * 名称 - */ - @NotEmpty(message = "品牌名不能为空") - private String name; - - /** - * 描述 - */ - @NotEmpty(message = "品牌描述不能为空") - private String description; - - /** - * 图片地址 - */ - @NotEmpty(message = "品牌图片地址不能为空") - private String picUrl; - - /** - * 状态 - * - * 1-开启 - * 2-禁用 - */ - @NotNull(message = "品牌状态不能为空") - private Integer status; - -} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandUpdateDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandUpdateDTO.java deleted file mode 100644 index c977f8a0e..000000000 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandUpdateDTO.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.iocoder.mall.product.biz.dto.brand; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -/** - * Product 品牌添加 DTO - */ -@Data -@Accessors(chain = true) -public class ProductBrandUpdateDTO { - - /** - * 主键 - */ - @NotNull(message = "品牌主键不能为空") - private Integer id; - - /** - * 名称 - */ - @NotEmpty(message = "品牌名不能为空") - private String name; - - /** - * 描述 - */ - @NotEmpty(message = "品牌描述不能为空") - private String description; - - /** - * 图片地址 - */ - @NotEmpty(message = "品牌图片地址不能为空") - private String picUrl; - - /** - * 状态 - * - * 1-开启 - * 2-禁用 - */ - @NotNull(message = "品牌状态不能为空") - private Integer status; - -} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandService.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandService.java deleted file mode 100644 index d2a60d0ab..000000000 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandService.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.iocoder.mall.product.biz.service.brand; - - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO; -import cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO; -import cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO; -import cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO; - -public interface ProductBrandService { - - /** - * 获取品牌分页数据 - * - * @param productBrandPageDTO 翻页参数 - * @return - */ - PageResult getProductBrandPage(ProductBrandPageDTO productBrandPageDTO); - - /** - * 获取品牌明细 - * - * @param id 主键 - * @return - */ - ProductBrandBO getProductBrand(Integer id); - - /** - * 添加品牌 - * - * @param productBrandAddDTO 添加参数 - * @return - */ - ProductBrandBO addProductBrand(Integer adminId, ProductBrandAddDTO productBrandAddDTO); - - /** - * 更新品牌 - * - * @param productBrandUpdateDTO 更新参数 - * @return - */ - Boolean updateProductBrand(Integer adminId, ProductBrandUpdateDTO productBrandUpdateDTO); - - -} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java deleted file mode 100644 index b70a7b5ff..000000000 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -package cn.iocoder.mall.product.biz.service.brand; - -import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; -import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO; -import cn.iocoder.mall.product.biz.convert.brand.ProductBrandConvert; -import cn.iocoder.mall.product.biz.dao.brand.ProductBrandMapper; -import cn.iocoder.mall.product.biz.dataobject.brand.ProductBrandDO; -import cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO; -import cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO; -import cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO; -import cn.iocoder.mall.product.biz.enums.ProductErrorCodeEnum; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Date; - -/** - * 商品规格 Service 实现类 - * - * @see ProductBrandDO - */ -@Service -public class ProductBrandServiceImpl implements ProductBrandService { - - @Autowired - private ProductBrandMapper productBrandMapper; - - @Override - public PageResult getProductBrandPage(ProductBrandPageDTO productBrandPageDTO) { - IPage brandPage = productBrandMapper.selectPageByParams(productBrandPageDTO); - return ProductBrandConvert.INSTANCE.convertPage(brandPage); - } - - @Override - public ProductBrandBO getProductBrand(Integer brandId) { - return ProductBrandConvert.INSTANCE.convert(productBrandMapper.selectById(brandId)); - } - - @Override - public ProductBrandBO addProductBrand(Integer adminId, ProductBrandAddDTO productBrandAddDTO) { - // 校验品牌名不重复 - int count = productBrandMapper.selectCount(Wrappers.query().lambda() - .eq(ProductBrandDO::getName, productBrandAddDTO.getName()) - .eq(ProductBrandDO::getDeleted, false)); - if (count > 0) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_BRAND_EXIST.getCode()); - } - ProductBrandDO productBrandDO = ProductBrandConvert.INSTANCE.convert(productBrandAddDTO); - productBrandDO.setCreateTime(new Date()); - productBrandDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue()); - productBrandMapper.insert(productBrandDO); - return ProductBrandConvert.INSTANCE.convert(productBrandDO); - } - - @Override - public Boolean updateProductBrand(Integer adminId, ProductBrandUpdateDTO productBrandUpdateDTO) { - ProductBrandDO productBrandDO = ProductBrandConvert.INSTANCE.convert(productBrandUpdateDTO); - productBrandDO.setUpdateTime(new Date()); - productBrandMapper.updateById(productBrandDO); - return true; - } -} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/category/AdminsProductCategoryController.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/category/AdminsProductCategoryController.java deleted file mode 100644 index 278e6a287..000000000 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/category/AdminsProductCategoryController.java +++ /dev/null @@ -1,110 +0,0 @@ -package cn.iocoder.mall.product.rest.controller.category; - -import cn.iocoder.common.framework.enums.MallConstants; -import cn.iocoder.common.framework.vo.CommonResult; -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.biz.enums.category.ProductCategoryNodeEnum; -import cn.iocoder.mall.product.biz.service.category.ProductCategoryService; -import cn.iocoder.mall.product.rest.convert.category.AdminsProductCategoryConvert; -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 cn.iocoder.mall.security.core.context.AdminSecurityContextHolder; -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.web.bind.annotation.*; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * @Author: jiangweifan - * @Date: 2020/5/6 - * @Description: 商品分类 - API - */ -@RestController -@RequestMapping(MallConstants.ROOT_PATH_ADMIN + "/category") -@Api(tags = "管理员 - 商品分类 API") -public class AdminsProductCategoryController { - - @Autowired - private ProductCategoryService productCategoryService; - - @GetMapping("/tree") - @ApiOperation("获取分类树结构") - public CommonResult> tree() { - List productCategories = productCategoryService.getAllProductCategory(); - // 创建 ProductCategoryTreeNodeVO Map - Map treeNodeMap = productCategories.stream().collect(Collectors.toMap(ProductCategoryBO::getId, AdminsProductCategoryConvert.INSTANCE::convertToTreeNodeResponse)); - // 处理父子关系 - treeNodeMap.values().stream() - .filter(node -> !node.getPid().equals(ProductCategoryNodeEnum.ROOT.getId())) - .forEach((childNode) -> { - // 获得父节点 - AdminsProductCategoryTreeNodeResponse parentNode = treeNodeMap.get(childNode.getPid()); - if (parentNode.getChildren() == null) { // 初始化 children 数组 - parentNode.setChildren(new ArrayList<>()); - } - // 将自己添加到父节点中 - parentNode.getChildren().add(childNode); - }); - // 获得到所有的根节点 - List rootNodes = treeNodeMap.values().stream() - .filter(node -> node.getPid().equals(ProductCategoryNodeEnum.ROOT.getId())) - .sorted(Comparator.comparing(AdminsProductCategoryTreeNodeResponse::getSort)) - .collect(Collectors.toList()); - return success(rootNodes); - } - - @PostMapping("/add") - @ApiOperation(value = "创建商品分类") - public CommonResult add(AdminsProductCategoryAddRequest adminsProductCategoryAddRequest) { - // 转换 ProductCategoryAddDTO 对象 - ProductCategoryAddDTO productCategoryAddDTO = AdminsProductCategoryConvert.INSTANCE.convertToAddDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryAddRequest); - // 创建商品分类 - ProductCategoryBO addProductCategoryBO = productCategoryService.addProductCategory(productCategoryAddDTO); - // 返回结果 - return success(AdminsProductCategoryConvert.INSTANCE.convertToAddResponse(addProductCategoryBO)); - } - - @PostMapping("/update") - @ApiOperation(value = "更新商品分类") - public CommonResult update(AdminsProductCategoryUpdateRequest adminsProductCategoryUpdateRequest) { - // 创建 ProductCategoryUpdateDTO 对象 - ProductCategoryUpdateDTO productCategoryUpdateDTO = AdminsProductCategoryConvert.INSTANCE.convertToUpdateDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryUpdateRequest); - // 更新商品分类 - return success(productCategoryService.updateProductCategory(productCategoryUpdateDTO)); - } - - @PostMapping("/update_status") - @ApiOperation(value = "更新商品分类状态") - public CommonResult updateStatus(AdminsProductCategoryUpdateStatusRequest adminsProductCategoryUpdateStatusRequest) { - // 创建 ProductCategoryUpdateStatusDTO 对象 - ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO = AdminsProductCategoryConvert.INSTANCE.convertToUpdateStatusDTO(AdminSecurityContextHolder.getContext().getAdminId(), - adminsProductCategoryUpdateStatusRequest); - // 更新商品分类状态 - return success(productCategoryService.updateProductCategoryStatus(productCategoryUpdateStatusDTO)); - } - - @PostMapping("/delete") - @ApiOperation(value = "删除商品分类") - @ApiImplicitParam(name = "id", value = "商品分类编号", required = true, example = "1") - public CommonResult delete(@RequestParam("id") Integer id) { - // 创建 ProductCategoryDeleteDTO 对象 - ProductCategoryDeleteDTO productCategoryDeleteDTO = AdminsProductCategoryConvert.INSTANCE.convertToDeleteDTO(AdminSecurityContextHolder.getContext().getAdminId(), id); - // 删除商品分类 - return success(productCategoryService.deleteProductCategory(productCategoryDeleteDTO)); - } - -} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandAddRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandAddRequest.java deleted file mode 100644 index 6eea75ccc..000000000 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandAddRequest.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.product.rest.request.brand; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; - -@ApiModel("商品 - 品牌模块 - 商品品牌新增 Request") -@Data -@Accessors(chain = true) -public class ProductBrandAddRequest { - - @ApiModelProperty(name = "name", value = "品牌名称", required = true, example = "安踏") - @NotEmpty(message = "品牌名称不能为空") - private String name; - - @ApiModelProperty(name = "description", value = "品牌描述", required = true, example = "安踏拖鞋") - private String description; - - @ApiModelProperty(name = "picUrl", value = "品牌图片", required = true, example = "http://www.iocoder.cn") - private String picUrl; - - @ApiModelProperty(name = "status", value = "状态 1开启 2禁用", required = true, example = "1") - private Integer status; -} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandPageRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandPageRequest.java deleted file mode 100644 index 24c038f62..000000000 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandPageRequest.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.mall.product.rest.request.brand; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -@ApiModel("商品 - 品牌模块 - 品牌分页 Request") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class ProductBrandPageRequest extends PageParam { - - @ApiModelProperty(name = "name", value = "品牌名称", required = true, example = "安踏") - private String name; - - @ApiModelProperty(name = "name", value = "品牌描述", required = true, example = "安踏拖鞋") - private String description; - - @ApiModelProperty(name = "name", value = "状态 1开启 2禁用", required = true, example = "1") - private String status; -} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandUpdateRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandUpdateRequest.java deleted file mode 100644 index de429c720..000000000 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandUpdateRequest.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.mall.product.rest.request.brand; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("商品 - 品牌模块 - 商品品牌更新 Request") -@Data -@Accessors(chain = true) -public class ProductBrandUpdateRequest { - - @ApiModelProperty(name = "id", value = "规格编号", required = true, example = "1") - @NotNull(message = "品牌编号不能为空") - private Integer id; - - @ApiModelProperty(name = "name", value = "品牌名称", required = true, example = "安踏") - @NotEmpty(message = "品牌名称不能为空") - private String name; - - @ApiModelProperty(name = "description", value = "品牌描述", required = true, example = "安踏拖鞋") - private String description; - - @ApiModelProperty(name = "picUrl", value = "品牌图片", required = true, example = "http://www.iocoder.cn") - private String picUrl; - - @ApiModelProperty(name = "status", value = "状态 1开启 2禁用", required = true, example = "1") - private Integer status; -} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryAddResponse.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryAddResponse.java deleted file mode 100644 index 3b713e3a4..000000000 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryAddResponse.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.mall.product.rest.response.category; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; -import java.util.Date; - -/** - * @Author: jiangweifan - * @Date: 2020/5/6 - * @Description: 管理员 - 商品分类 - 新增商品分类Response - */ -@ApiModel("创建商品分类Response") -@Data -@Accessors(chain = true) -public class AdminsProductCategoryAddResponse { - - @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/images/common/wechat_mp_2017_07_31_bak.jpg") - private String picUrl; - - @ApiModelProperty(value = "排序值", required = true, example = "10") - private Integer sort; - - @ApiModelProperty(value = "状态", required = true, notes = "1-开启;2-关闭", example = "1") - private Integer status; - - @ApiModelProperty(value = "创建时间", required = true, example = "时间戳") - private Date createTime; - -} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryTreeNodeResponse.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryTreeNodeResponse.java deleted file mode 100644 index c6ec1b782..000000000 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryTreeNodeResponse.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.mall.product.rest.response.category; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; -import java.util.List; - -/** - * @Author: jiangweifan - * @Date: 2020/5/6 - * @Description: 管理员 - 商品分类 - 分类树Response - */ -@ApiModel("商品分类树节点") -@Data -@Accessors(chain = true) -public class AdminsProductCategoryTreeNodeResponse { - - @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/images/common/wechat_mp_2017_07_31_bak.jpg") - private String picUrl; - - @ApiModelProperty(value = "排序值", required = true, example = "10") - private Integer sort; - - @ApiModelProperty(value = "状态", required = true, notes = "1-开启;2-关闭", example = "1") - private Integer status; - - @ApiModelProperty(value = "创建时间", required = true, example = "时间戳") - private Date createTime; - - @ApiModelProperty(value = "子节点数组") - private List children; - -} diff --git a/product/product-rest/src/main/resources/rest.yaml b/product/product-rest/src/main/resources/rest.yaml deleted file mode 100644 index 37801cc94..000000000 --- a/product/product-rest/src/main/resources/rest.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# 服务器的配置项 -server: - port: 18081 - servlet: - context-path: /product-api/ - -# Swagger 配置项 -swagger: - title: 商品子系统 - description: 商品子系统 - version: 1.0.0 - base-package: cn.iocoder.mall.system.rest.controller diff --git a/product/product-rpc-api/src/main/java/cn/iocoder/mall/product/rpc/package-info.java b/product/product-rpc-api/src/main/java/cn/iocoder/mall/product/rpc/package-info.java deleted file mode 100644 index 4c49428c5..000000000 --- a/product/product-rpc-api/src/main/java/cn/iocoder/mall/product/rpc/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * 提供 system 服务的 RPC 接口的定义,提供内部调用 - */ -package cn.iocoder.mall.product.rpc; diff --git a/product/product-rpc/src/main/java/cn/iocoder/mall/product/rpc/package-info.java b/product/product-rpc/src/main/java/cn/iocoder/mall/product/rpc/package-info.java deleted file mode 100644 index 045fb0f93..000000000 --- a/product/product-rpc/src/main/java/cn/iocoder/mall/product/rpc/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * 提供 product 服务的 RPC 接口的实现,提供内部调用 - */ -package cn.iocoder.mall.product.rpc; diff --git a/product/product-rpc/src/main/resources/rpc-local.yaml b/product/product-rpc/src/main/resources/rpc-local.yaml deleted file mode 100644 index e056170af..000000000 --- a/product/product-rpc/src/main/resources/rpc-local.yaml +++ /dev/null @@ -1,14 +0,0 @@ -spring: - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: s1.iocoder.cn:8848 # Nacos 服务器地址 - namespace: local # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 diff --git a/product/product-rpc/src/main/resources/rpc-test.yaml b/product/product-rpc/src/main/resources/rpc-test.yaml deleted file mode 100644 index d3d0e9e69..000000000 --- a/product/product-rpc/src/main/resources/rpc-test.yaml +++ /dev/null @@ -1,14 +0,0 @@ -spring: - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: s1.iocoder.cn:8848 # Nacos 服务器地址 - namespace: test # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 diff --git a/product/product-rpc/src/main/resources/rpc.yaml b/product/product-rpc/src/main/resources/rpc.yaml deleted file mode 100644 index 8cacacf0a..000000000 --- a/product/product-rpc/src/main/resources/rpc.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Dubbo 配置项 -dubbo: - # Spring Cloud Alibaba Dubbo 专属配置 - cloud: - subscribed-services: 'product-application' # 设置订阅的应用列表,默认为 * 订阅所有应用 - # Dubbo 提供者的协议 - protocol: - name: dubbo - port: -1 - # Dubbo 提供服务的扫描基础包 - scan: - base-packages: cn.iocoder.mall.product.rpc.rpc - # Dubbo 服务提供者的配置 - provider: - filter: -exception - ProductSpuService: - version: 1.0.0 - - # Dubbo 服务消费者的配置 - consumer: - ProductSpuService: - version: 1.0.0 diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductBrandService.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductBrandService.java deleted file mode 100644 index bab3463d7..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductBrandService.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.mall.product.api; - -import cn.iocoder.mall.product.api.bo.ProductBrandBO; -import cn.iocoder.mall.product.api.bo.ProductBrangPageBO; -import cn.iocoder.mall.product.api.dto.ProductBrandAddDTO; -import cn.iocoder.mall.product.api.dto.ProductBrandPageDTO; -import cn.iocoder.mall.product.api.dto.ProductBrandUpdateDTO; - -public interface ProductBrandService { - - /** - * 获取品牌分页数据 - * @param productBrandPageDTO 翻页参数 - * @return - */ - ProductBrangPageBO getProductBrandPage(ProductBrandPageDTO productBrandPageDTO); - - /** - * 获取品牌明细 - * @param id 主键 - * @return - */ - ProductBrandBO getProductBrand(Integer id); - - /** - * 添加品牌 - * @param productBrandAddDTO 添加参数 - * @return - */ - ProductBrandBO addProductBrand(Integer adminId, ProductBrandAddDTO productBrandAddDTO); - - /** - * 更新品牌 - * @param productBrandUpdateDTO 更新参数 - * @return - */ - Boolean updateProductBrand(Integer adminId, ProductBrandUpdateDTO productBrandUpdateDTO); - - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductCategoryService.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductCategoryService.java deleted file mode 100644 index 97d9a534f..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductCategoryService.java +++ /dev/null @@ -1,42 +0,0 @@ -package cn.iocoder.mall.product.api; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -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.Collection; -import java.util.List; - -public interface ProductCategoryService { - - /** - * @param pid 指定父分类编号 - * @return 返回指定分类编号的子产品分类们 - */ - List getListByPid(Integer pid); - - /** - * 获得商品分类数组 - * - * @param ids 商品分类编号 - * @return 数组 - */ - List getListByIds(Collection ids); - - /** - * @return 返回所有产品分类们 - */ - List getAll(); - - ProductCategoryBO addProductCategory(Integer adminId, ProductCategoryAddDTO productCategoryAddDTO); - - Boolean updateProductCategory(Integer adminId, ProductCategoryUpdateDTO productCategoryUpdateDTO); - - Boolean updateProductCategoryStatus(Integer adminId, Integer productCategoryId, - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status); - - Boolean deleteProductCategory(Integer admin, Integer productCategoryId); - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductBrangPageBO.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductBrangPageBO.java deleted file mode 100644 index 98c0e84ab..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductBrangPageBO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.mall.product.api.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** - * 商品品牌分页 BO - */ -@Data -@Accessors(chain = true) -public class ProductBrangPageBO implements Serializable { - - /** - * 品牌数组 - */ - private List brands; - /** - * 总数 - */ - private Integer count; - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductAttrConstants.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductAttrConstants.java deleted file mode 100644 index d454b800a..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductAttrConstants.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.mall.product.api.constant; - -public class ProductAttrConstants { - - /** - * ATTR 状态 - 开启 - */ - public static final Integer ATTR_STATUS_ENABLE = 1; - /** - * ATTR 状态 - 关闭 - */ - public static final Integer ATTR_STATUS_DISABLE = 2; - - /** - * ATTR_VALUE 状态 - 开启 - */ - public static final Integer ATTR_VALUE_STATUS_ENABLE = 1; - /** - * ATTR_VALUE 状态 - 关闭 - */ - public static final Integer ATTR_VALUE_STATUS_DISABLE = 2; - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductCategoryConstants.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductCategoryConstants.java deleted file mode 100644 index ebf6bfb99..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductCategoryConstants.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.product.api.constant; - -public class ProductCategoryConstants { - - /** - * 状态 - 开启 - */ - public static final Integer STATUS_ENABLE = 1; - /** - * 状态 - 关闭 - */ - public static final Integer STATUS_DISABLE = 2; - - /** - * 父分类编号 - 根节点 - */ - public static final Integer PID_ROOT = 0; - -} \ No newline at end of file diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductErrorCodeEnum.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductErrorCodeEnum.java deleted file mode 100644 index e753d0ca9..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductErrorCodeEnum.java +++ /dev/null @@ -1,54 +0,0 @@ -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(1002001003, "商品分类已经是该状态"), - PRODUCT_CATEGORY_DELETE_ONLY_DISABLE(1002001004, "只有关闭的商品分类才可以删除"), - PRODUCT_CATEGORY_MUST_ENABLE(1002001005, "只有开启的商品分类,才可以使用"), - PRODUCT_CATEGORY_PARENT_CAN_NOT_BE_LEVEL2(1002001005, "父分类必须是一级分类"), - - // ========== PRODUCT SPU + SKU 模块 ========== - PRODUCT_SKU_ATTR_CANT_NOT_DUPLICATE(1003002000, "一个 Sku 下,不能有重复的规格"), - PRODUCT_SPU_ATTR_NUMBERS_MUST_BE_EQUALS(1003002001, "一个 Spu 下的每个 Sku ,其规格数必须一致"), - PRODUCT_SPU_SKU__NOT_DUPLICATE(1003002002, "一个 Spu 下的每个 Sku ,必须不重复"), - PRODUCT_SPU_NOT_EXISTS(1003002003, "Spu 不存在"), - PRODUCT_SPU_CATEGORY_MUST_BE_LEVEL2(1003002003, "Spu 只能添加在二级分类下"), - - // ========== PRODUCT ATTR + ATTR_VALUE 模块 ========== - PRODUCT_ATTR_VALUE_NOT_EXIST(1003003000, "商品属性值不存在"), - PRODUCT_ATTR_NOT_EXIST(1003003001, "商品属性值不存在"), - PRODUCT_ATTR_EXISTS(1003003002, "商品规格已经存在"), - PRODUCT_ATTR_STATUS_EQUALS(1003003003, "商品规格已经是该状态"), - PRODUCT_ATTR_VALUE_EXISTS(1003003004, "商品规格值已经存在"), - PRODUCT_ATTR_VALUE_STATUS_EQUALS(1003003005, "商品规格值已经是该状态"), - - // ========== PRODUCT BRAND模块 ========== - PRODUCT_BRAND_EXIST(1003004000, "品牌值已经存在"), - ; - - 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; - } - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductSpuConstants.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductSpuConstants.java deleted file mode 100644 index 686157097..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductSpuConstants.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.mall.product.api.constant; - -public class ProductSpuConstants { - - /** - * 状态 - 开启 - */ - public static final Integer SKU_STATUS_ENABLE = 1; - /** - * 状态 - 关闭 - */ - public static final Integer SKU_STATUS_DISABLE = 2; - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandAddDTO.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandAddDTO.java deleted file mode 100644 index 4a9c7e9cc..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandAddDTO.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.mall.product.api.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -/** - * Product 品牌添加 DTO - */ -@Data -@Accessors(chain = true) -public class ProductBrandAddDTO { - - /** - * 名称 - */ - @NotEmpty(message = "品牌名不能为空") - private String name; - - /** - * 描述 - */ - @NotEmpty(message = "品牌描述不能为空") - private String description; - - /** - * 图片地址 - */ - @NotEmpty(message = "品牌图片地址不能为空") - private String picUrl; - - /** - * 状态 - * - * 1-开启 - * 2-禁用 - */ - @NotNull(message = "品牌状态不能为空") - private Integer status; - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandPageDTO.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandPageDTO.java deleted file mode 100644 index 5d5c0b442..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandPageDTO.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.mall.product.api.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; - -/** - * 商品品牌分页 DTO - */ -@Data -@Accessors(chain = true) -public class ProductBrandPageDTO { - - /** - * 名称 - */ - private String name; - - /** - * 描述 - */ - private String description; - - /** - * 状态 1-开启 2-禁用 - */ - private Integer status; - - @NotNull(message = "页码不能为空") - private Integer pageNo; - - @NotNull(message = "每页条数不能为空") - private Integer pageSize; - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandUpdateDTO.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandUpdateDTO.java deleted file mode 100644 index ec29bfa5d..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandUpdateDTO.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.iocoder.mall.product.api.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -/** - * Product 品牌添加 DTO - */ -@Data -@Accessors(chain = true) -public class ProductBrandUpdateDTO { - - /** - * 主键 - */ - @NotNull(message = "品牌主键不能为空") - private Integer id; - - /** - * 名称 - */ - @NotEmpty(message = "品牌名不能为空") - private String name; - - /** - * 描述 - */ - @NotEmpty(message = "品牌描述不能为空") - private String description; - - /** - * 图片地址 - */ - @NotEmpty(message = "品牌图片地址不能为空") - private String picUrl; - - /** - * 状态 - * - * 1-开启 - * 2-禁用 - */ - @NotNull(message = "品牌状态不能为空") - private Integer status; - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryAddDTO.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryAddDTO.java deleted file mode 100644 index 30eeeca5f..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryAddDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.product.api.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; - -/** - * 商品分类添加 DTO - */ -@Data -@Accessors(chain = true) -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; - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryUpdateDTO.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryUpdateDTO.java deleted file mode 100644 index 0f6e28d60..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryUpdateDTO.java +++ /dev/null @@ -1,46 +0,0 @@ -package cn.iocoder.mall.product.api.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; - -/** - * 商品分类更新 DTO - */ -@Data -@Accessors(chain = true) -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; - -} diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/config/DatabaseConfiguration.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/config/DatabaseConfiguration.java deleted file mode 100644 index 230e57a10..000000000 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/config/DatabaseConfiguration.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.mall.product.config; - -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@Configuration -@MapperScan("cn.iocoder.mall.product.dao") // 扫描对应的 Mapper 接口 -@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理。为什么使用 proxyTargetClass 参数,参见 https://blog.csdn.net/huang_550/article/details/76492600 -public class DatabaseConfiguration { - -} diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/config/ServiceExceptionConfiguration.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/config/ServiceExceptionConfiguration.java deleted file mode 100644 index e5f1e1ea3..000000000 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/config/ServiceExceptionConfiguration.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.product.config; - -import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.product.api.constant.ProductErrorCodeEnum; -import org.springframework.boot.context.event.ApplicationReadyEvent; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.event.EventListener; - -@Configuration -public class ServiceExceptionConfiguration { - - @EventListener(ApplicationReadyEvent.class) // 可参考 https://www.cnblogs.com/ssslinppp/p/7607509.html - public void initMessages() { -// 从 service_exception_message.properties 加载错误码的方案 -// Properties properties; -// try { -// properties = PropertiesLoaderUtils.loadAllProperties("classpath:service_exception_message.properties"); -// } catch (IOException e) { -// throw new RuntimeException(e); -// } - for (ProductErrorCodeEnum item : ProductErrorCodeEnum.values()) { - ServiceExceptionUtil.put(item.getCode(), item.getMessage()); - } - } - -} \ No newline at end of file diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductBrandConvert.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductBrandConvert.java deleted file mode 100644 index 9e442ef48..000000000 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductBrandConvert.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.product.convert; - -import cn.iocoder.mall.product.api.bo.ProductBrandBO; -import cn.iocoder.mall.product.api.dto.ProductBrandAddDTO; -import cn.iocoder.mall.product.api.dto.ProductBrandUpdateDTO; -import cn.iocoder.mall.product.dataobject.ProductBrandDO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductBrandConvert { - - ProductBrandConvert INSTANCE = Mappers.getMapper(ProductBrandConvert.class); - - @Mappings({}) - List convert(List brands); - - @Mappings({}) - ProductBrandBO convert(ProductBrandDO brand); - - @Mappings({}) - ProductBrandDO convert(ProductBrandUpdateDTO brand); - - @Mappings({}) - ProductBrandDO convert(ProductBrandAddDTO brand); - -} \ No newline at end of file diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductCategoryConvert.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductCategoryConvert.java deleted file mode 100644 index e43f76604..000000000 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductCategoryConvert.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.product.convert; - -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 cn.iocoder.mall.product.dataobject.ProductCategoryDO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductCategoryConvert { - - ProductCategoryConvert INSTANCE = Mappers.getMapper(ProductCategoryConvert.class); - - @Mappings({}) - ProductCategoryBO convertToBO(ProductCategoryDO category); - - @Mappings({}) - List convertToBO(List categoryList); - - @Mappings({}) - ProductCategoryDO convert(ProductCategoryAddDTO productCategoryAddDTO); - - @Mappings({}) - ProductCategoryDO convert(ProductCategoryUpdateDTO productCategoryUpdateDTO); - -} \ No newline at end of file diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductBrandMapper.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductBrandMapper.java deleted file mode 100644 index 23947c6b1..000000000 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductBrandMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package cn.iocoder.mall.product.dao; - -import cn.iocoder.mall.product.dataobject.ProductBrandDO; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -public interface ProductBrandMapper { - - /** - * 根据 id 获取数据 - * @param id - * @return - */ - ProductBrandDO selectById(@Param("id") Integer id); - - /** - * 根据 name 获取数据 - * @param name - * @return - */ - ProductBrandDO selectByName(@Param("name") String name); - - - /** - * 分页查询 - * @param name 名称 - * @param description 描述 - * @param status 状态 1开启 2禁用 - * @param offset 偏移量 - * @param limit 数量 - * @return - */ - List selectListByParams(@Param("name") String name, - @Param("description") String description, - @Param("status") Integer status, - @Param("offset") Integer offset, - @Param("limit") Integer limit); - - /** - * 分页数量统计 - * @param name 名称 - * @param description 描述 - * @param status 状态 1开启 2禁用 - * @return - */ - Integer selectListCountByParams(@Param("name") String name, - @Param("description") String description, - @Param("status") Integer status); - - /** - * 新增数据 - * @param productBrandDO - */ - void insert(ProductBrandDO productBrandDO); - - /** - * 更新数据 - * @param productBrandDO - */ - void update(ProductBrandDO productBrandDO); - -} \ No newline at end of file diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductCategoryMapper.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductCategoryMapper.java deleted file mode 100644 index 187d2ac03..000000000 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductCategoryMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.product.dao; - -import cn.iocoder.mall.product.dataobject.ProductCategoryDO; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.Collection; -import java.util.List; - -@Repository -public interface ProductCategoryMapper { - - List selectListByPidAndStatusOrderBySort(@Param("pid") Integer pid, - @Param("status") Integer status); - - List selectList(); - - ProductCategoryDO selectById(@Param("id") Integer id); - - List selectByIds(@Param("ids") Collection ids); - - void insert(ProductCategoryDO productCategoryDO); - - int update(ProductCategoryDO productCategoryDO); - -} diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductBrandDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductBrandDO.java deleted file mode 100644 index 8dc593d82..000000000 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductBrandDO.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.product.dataobject; - -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * Product 品牌 - */ -@Data -@Accessors(chain = true) -public class ProductBrandDO extends DeletableDO { - - /** - * 规格编号 - */ - private Integer id; - /** - * 名称 - */ - private String name; - - /** - * 描述 - */ - private String description; - - /** - * 图片地址 - */ - private String picUrl; - - /** - * 状态 - * - * 1-开启 - * 2-禁用 - */ - private Integer status; - -} diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java deleted file mode 100644 index c02eee672..000000000 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.mall.product.dataobject; - -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 商品分类 - */ -@Data -@Accessors(chain = true) -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-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductBrandServiceImpl.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductBrandServiceImpl.java deleted file mode 100644 index 1135c2101..000000000 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductBrandServiceImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -package cn.iocoder.mall.product.service; - -import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.product.api.ProductBrandService; -import cn.iocoder.mall.product.api.bo.ProductBrandBO; -import cn.iocoder.mall.product.api.bo.ProductBrangPageBO; -import cn.iocoder.mall.product.api.constant.ProductErrorCodeEnum; -import cn.iocoder.mall.product.api.dto.ProductBrandAddDTO; -import cn.iocoder.mall.product.api.dto.ProductBrandPageDTO; -import cn.iocoder.mall.product.api.dto.ProductBrandUpdateDTO; -import cn.iocoder.mall.product.convert.ProductBrandConvert; -import cn.iocoder.mall.product.dao.ProductBrandMapper; -import cn.iocoder.mall.product.dataobject.ProductBrandDO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * 商品规格 Service 实现类 - * - * @see ProductBrandDO - */ -@Service -@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.ProductBrandService.version}") -public class ProductBrandServiceImpl implements ProductBrandService { - - @Autowired - private ProductBrandMapper productBrandMapper; - - /** - * 获取品牌分页数据 - * @param productBrandPageDTO 分页参数 - * @return - */ - @Override - public ProductBrangPageBO getProductBrandPage(ProductBrandPageDTO productBrandPageDTO) { - ProductBrangPageBO productBrangPageBO = new ProductBrangPageBO(); - // 查询分页数据 - int offset = (productBrandPageDTO.getPageNo() - 1) * productBrandPageDTO.getPageSize(); - productBrangPageBO.setBrands( - ProductBrandConvert.INSTANCE.convert( - productBrandMapper.selectListByParams(productBrandPageDTO.getName(), - productBrandPageDTO.getDescription(), - productBrandPageDTO.getStatus(), - offset, productBrandPageDTO.getPageSize()))); - // 查询分页总数 - productBrangPageBO.setCount(productBrandMapper.selectListCountByParams(productBrandPageDTO.getName(), - productBrandPageDTO.getDescription(), - productBrandPageDTO.getStatus())); - return productBrangPageBO; - } - - /** - * 获取品牌明细 - * @param id 主键 - * @return - */ - @Override - public ProductBrandBO getProductBrand(Integer id) { - ProductBrandBO productBrandBO = new ProductBrandBO(); - productBrandBO = ProductBrandConvert.INSTANCE.convert(productBrandMapper.selectById(id)); - return productBrandBO; - } - - /** - * 添加品牌 - * @param adminId - * @param productBrandAddDTO 添加参数 - * @return - */ - @Override - public ProductBrandBO addProductBrand(Integer adminId, ProductBrandAddDTO productBrandAddDTO) { - // 校验品牌名不重复 - if (productBrandMapper.selectByName(productBrandAddDTO.getName()) != null) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_BRAND_EXIST.getCode()); - } - ProductBrandDO productBrandDO = new ProductBrandDO(); - productBrandDO = ProductBrandConvert.INSTANCE.convert(productBrandAddDTO); - productBrandMapper.insert(productBrandDO); - return ProductBrandConvert.INSTANCE.convert(productBrandDO); - } - - /** - * 更新品牌 - * @param adminId - * @param productBrandUpdateDTO 更新参数 - * @return - */ - @Override - public Boolean updateProductBrand(Integer adminId, ProductBrandUpdateDTO productBrandUpdateDTO) { - ProductBrandDO productBrandDO = new ProductBrandDO(); - productBrandDO = ProductBrandConvert.INSTANCE.convert(productBrandUpdateDTO); - productBrandMapper.update(productBrandDO); - return true; - } -} diff --git a/product/product-service-impl/src/main/resources/mapper/ProductBrandMapper.xml b/product/product-service-impl/src/main/resources/mapper/ProductBrandMapper.xml deleted file mode 100644 index b20d6b3a4..000000000 --- a/product/product-service-impl/src/main/resources/mapper/ProductBrandMapper.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - id, name, description, pic_url, status, create_time - - - - - - - - - INSERT INTO product_brand ( - name, description, pic_url, status, create_time, deleted - ) VALUES ( - #{name}, #{description}, #{picUrl}, #{status}, #{createTime}, #{deleted} - ) - - - - UPDATE product_brand - - - name = #{name}, - - - description = #{description}, - - - pic_url = #{picUrl}, - - - status = #{status}, - - - deleted = #{deleted} - - - WHERE id = #{id} - - - - - - - - - \ No newline at end of file diff --git a/product/product-service-impl/src/main/resources/mapper/ProductCategoryMapper.xml b/product/product-service-impl/src/main/resources/mapper/ProductCategoryMapper.xml deleted file mode 100644 index 47e484d97..000000000 --- a/product/product-service-impl/src/main/resources/mapper/ProductCategoryMapper.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - id, pid, name, description, pic_url, - sort, status, create_time - - - - - - - - - - - - INSERT INTO product_category ( - pid, name, description, pic_url, sort, - status, create_time, deleted - ) VALUES ( - #{pid}, #{name}, #{description}, #{picUrl}, #{sort}, - #{status}, #{createTime}, #{deleted} - ) - - - - UPDATE product_category - - - pid = #{pid}, - - - name = #{name}, - - - description = #{description}, - - - pic_url = #{picUrl}, - - - sort = #{sort}, - - - status = #{status}, - - - deleted = #{deleted} - - - WHERE id = #{id} - - - diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/ProductApplication.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/ProductApplication.java deleted file mode 100644 index 81aed8b6a..000000000 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/ProductApplication.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.product.application; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.context.config.ConfigFileApplicationListener; -import org.springframework.scheduling.annotation.EnableAsync; - -@SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.product"}) -@EnableAsync(proxyTargetClass = true) -public class ProductApplication { - - /** - * 设置需要读取的配置文件的名字。 - * 基于 {@link org.springframework.boot.context.config.ConfigFileApplicationListener#CONFIG_NAME_PROPERTY} 实现。 - */ - private static final String CONFIG_NAME_VALUE = "biz,rest,rpc,application"; - - public static void main(String[] args) { - // 设置环境变量 - System.setProperty(ConfigFileApplicationListener.CONFIG_NAME_PROPERTY, CONFIG_NAME_VALUE); - - // 启动 Spring Boot 应用 - SpringApplication.run(ProductApplication.class, args); - } - -} diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductBrandController.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductBrandController.java deleted file mode 100644 index 965191b59..000000000 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductBrandController.java +++ /dev/null @@ -1,113 +0,0 @@ -package cn.iocoder.mall.product.application.controller.admins; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.product.api.ProductBrandService; -import cn.iocoder.mall.product.api.bo.ProductBrandBO; -import cn.iocoder.mall.product.api.bo.ProductBrangPageBO; -import cn.iocoder.mall.product.api.dto.ProductBrandAddDTO; -import cn.iocoder.mall.product.api.dto.ProductBrandPageDTO; -import cn.iocoder.mall.product.api.dto.ProductBrandUpdateDTO; -import cn.iocoder.mall.product.application.convert.ProductBrandConvert; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductBrandVO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductBrangPageVO; -import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.apache.dubbo.config.annotation.Reference; -import org.springframework.web.bind.annotation.*; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@RestController -@RequestMapping("admins/brand") -@Api("商品品牌") -public class AdminsProductBrandController { - - @Reference(validation = "true", version = "${dubbo.provider.ProductBrandService.version}") - private ProductBrandService productBrandService; - - @PostMapping("/add") - @ApiOperation("创建品牌") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "品牌名称", required = true, example = "安踏"), - @ApiImplicitParam(name = "description", value = "品牌描述", required = true, example = "安踏拖鞋"), - @ApiImplicitParam(name = "picUrl", value = "品牌图片", required = true, example = "http://www.iocoder.cn"), - @ApiImplicitParam(name = "status", value = "状态 1开启 2禁用", required = true, example = "1") - }) - public CommonResult add(@RequestParam("name") String name, - @RequestParam("description") String description, - @RequestParam("picUrl") String picUrl, - @RequestParam("status") Integer status) { - // 创建 ProductBrandAddDTO 对象 - ProductBrandAddDTO productBrandAddDTO = new ProductBrandAddDTO().setName(name).setDescription(description) - .setPicUrl(picUrl).setStatus(status); - // 保存商品 - ProductBrandBO result = productBrandService.addProductBrand(AdminSecurityContextHolder.getContext().getAdminId(), productBrandAddDTO); - // 返回结果 - return success(ProductBrandConvert.INSTANCE.convert(result)); - } - - @PostMapping("/update") - @ApiOperation("更新商品") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "品牌主键", required = true, example = "1"), - @ApiImplicitParam(name = "name", value = "品牌名称", required = true, example = "安踏"), - @ApiImplicitParam(name = "description", value = "品牌描述", required = true, example = "安踏拖鞋"), - @ApiImplicitParam(name = "picUrl", value = "品牌图片", required = true, example = "http://www.iocoder.cn"), - @ApiImplicitParam(name = "status", value = "状态 1开启 2禁用", required = true, example = "1") - }) - public CommonResult update(@RequestParam("id") Integer id, - @RequestParam("name") String name, - @RequestParam("description") String description, - @RequestParam("picUrl") String picUrl, - @RequestParam("status") Integer status) { - // 创建 productBrandUpdateDTO 对象 - ProductBrandUpdateDTO productBrandUpdateDTO = new ProductBrandUpdateDTO().setId(id).setName(name).setDescription(description) - .setPicUrl(picUrl).setStatus(status); - // 更新商品 - productBrandService.updateProductBrand(AdminSecurityContextHolder.getContext().getAdminId(), productBrandUpdateDTO); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获取品牌") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "品牌主键", required = true, example = "1") - }) - public CommonResult add(@RequestParam("id") Integer id) { - // 保存商品 - ProductBrandBO result = productBrandService.getProductBrand(id); - // 返回结果 - return success(ProductBrandConvert.INSTANCE.convert(result)); - } - - @GetMapping("/page") - @ApiOperation("获得品牌分页") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "品牌名称", required = true, example = "安踏"), - @ApiImplicitParam(name = "description", value = "品牌描述", required = true, example = "安踏拖鞋"), - @ApiImplicitParam(name = "status", value = "状态 1开启 2禁用", required = true, example = "1"), - @ApiImplicitParam(name = "pageNo", value = "页码", required = true, example = "1"), - @ApiImplicitParam(name = "pageSize", value = "页面大小", required = true, example = "10") - }) - public CommonResult attrPage(@RequestParam(value = "name", required = false) String name, - @RequestParam(value = "description", required = false) String description, - @RequestParam(value = "status", required = false) Integer status, - @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { - // 创建 ProductAttrPageDTO 对象 - ProductBrandPageDTO productBrandPageDTO = new ProductBrandPageDTO().setName(name) - .setDescription(description) - .setStatus(status) - .setPageNo(pageNo) - .setPageSize(pageSize); - // 查询分页 - ProductBrangPageBO result = productBrandService.getProductBrandPage(productBrandPageDTO); - // 返回结果 - return success(ProductBrandConvert.INSTANCE.convert(result)); - } - - -} diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductCategoryController.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductCategoryController.java deleted file mode 100644 index 14151bde2..000000000 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductCategoryController.java +++ /dev/null @@ -1,126 +0,0 @@ -package cn.iocoder.mall.product.application.controller.admins; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.product.api.ProductCategoryService; -import cn.iocoder.mall.product.api.bo.ProductCategoryBO; -import cn.iocoder.mall.product.api.constant.ProductCategoryConstants; -import cn.iocoder.mall.product.api.dto.ProductCategoryAddDTO; -import cn.iocoder.mall.product.api.dto.ProductCategoryUpdateDTO; -import cn.iocoder.mall.product.application.convert.ProductCategoryConvert; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryTreeNodeVO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryVO; -import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.apache.dubbo.config.annotation.Reference; -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@RestController -@RequestMapping("admins/category") -@Api("商品分类") -public class AdminsProductCategoryController { - - @Reference(validation = "true", version = "${dubbo.provider.ProductCategoryService.version}") - private ProductCategoryService productCategoryService; - - @GetMapping("/tree") - @ApiOperation("获得分类树结构") - public CommonResult> tree() { - List productCategories = productCategoryService.getAll(); - // 创建 ProductCategoryTreeNodeVO Map - Map treeNodeMap = productCategories.stream().collect(Collectors.toMap(ProductCategoryBO::getId, ProductCategoryConvert.Admins.INSTANCE::convert)); - // 处理父子关系 - treeNodeMap.values().stream() - .filter(node -> !node.getPid().equals(ProductCategoryConstants.PID_ROOT)) - .forEach((childNode) -> { - // 获得父节点 - AdminsProductCategoryTreeNodeVO parentNode = treeNodeMap.get(childNode.getPid()); - if (parentNode.getChildren() == null) { // 初始化 children 数组 - parentNode.setChildren(new ArrayList<>()); - } - // 将自己添加到父节点中 - parentNode.getChildren().add(childNode); - }); - // 获得到所有的根节点 - List rootNodes = treeNodeMap.values().stream() - .filter(node -> node.getPid().equals(ProductCategoryConstants.PID_ROOT)) - .sorted(Comparator.comparing(AdminsProductCategoryTreeNodeVO::getSort)) - .collect(Collectors.toList()); - return success(rootNodes); - } - - @PostMapping("/add") - @ApiOperation(value = "创建商品分类") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pid", value = "父级分类编号", required = true, example = "1"), - @ApiImplicitParam(name = "name", value = "分类名字(标识)", required = true, example = "admin/info"), - @ApiImplicitParam(name = "description", value = "描述", required = true, example = "1"), - @ApiImplicitParam(name = "picUrl", value = "分类图片", example = "http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg/"), - @ApiImplicitParam(name = "sort", value = "排序", required = true, example = "1"), - }) - public CommonResult add(@RequestParam("pid") Integer pid, - @RequestParam("name") String name, - @RequestParam("description") String description, - @RequestParam(value = "picUrl", required = false) String picUrl, - @RequestParam("sort") Integer sort) { - // 创建 ProductCategoryAddDTO 对象 - ProductCategoryAddDTO productCategoryAddDTO = new ProductCategoryAddDTO().setPid(pid).setName(name) - .setDescription(description).setPicUrl(picUrl).setSort(sort); - // 创建商品分类 - ProductCategoryBO result = productCategoryService.addProductCategory(AdminSecurityContextHolder.getContext().getAdminId(), productCategoryAddDTO); - // 返回结果 - return success(ProductCategoryConvert.Admins.INSTANCE.convert2(result)); - } - - @PostMapping("/update") - @ApiOperation(value = "更新商品分类") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "分类编号", required = true, example = "1"), - @ApiImplicitParam(name = "pid", value = "父级分类编号", required = true, example = "1"), - @ApiImplicitParam(name = "name", value = "分类名字(标识)", required = true, example = "admin/info"), - @ApiImplicitParam(name = "description", value = "描述", required = true, example = "1"), - @ApiImplicitParam(name = "picUrl", value = "分类图片", example = "http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg/"), - @ApiImplicitParam(name = "sort", value = "排序", required = true, example = "1"), - }) - public CommonResult update(@RequestParam("id") Integer id, - @RequestParam("pid") Integer pid, - @RequestParam("name") String name, - @RequestParam("description") String description, - @RequestParam(value = "picUrl", required = false) String picUrl, - @RequestParam("sort") Integer sort) { - // 创建 ProductCategoryUpdateDTO 对象 - ProductCategoryUpdateDTO productCategoryAddDTO = new ProductCategoryUpdateDTO().setId(id).setPid(pid).setName(name) - .setDescription(description).setPicUrl(picUrl).setSort(sort); - // 更新商品分类 - return success(productCategoryService.updateProductCategory(AdminSecurityContextHolder.getContext().getAdminId(), productCategoryAddDTO)); - } - - @PostMapping("/update_status") - @ApiOperation(value = "更新商品分类状态") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "商品分类编号", required = true, example = "1"), - @ApiImplicitParam(name = "status", value = "状态。1 - 开启;2 - 禁用", required = true, example = "1"), - }) - public CommonResult updateStatus(@RequestParam("id") Integer id, - @RequestParam("status") Integer status) { - return success(productCategoryService.updateProductCategoryStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status)); - } - - @PostMapping("/delete") - @ApiOperation(value = "删除商品分类") - @ApiImplicitParam(name = "id", value = "商品分类编号", required = true, example = "1") - public CommonResult delete(@RequestParam("id") Integer id) { - return success(productCategoryService.deleteProductCategory(AdminSecurityContextHolder.getContext().getAdminId(), id)); - } - -} diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductBrandConvert.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductBrandConvert.java deleted file mode 100644 index 365f01ff9..000000000 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductBrandConvert.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.mall.product.application.convert; - -import cn.iocoder.mall.product.api.bo.ProductBrandBO; -import cn.iocoder.mall.product.api.bo.ProductBrangPageBO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductBrandVO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductBrangPageVO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface ProductBrandConvert { - - ProductBrandConvert INSTANCE = Mappers.getMapper(ProductBrandConvert.class); - - @Mappings({}) - AdminsProductBrandVO convert(ProductBrandBO result); - - @Mappings({}) - AdminsProductBrangPageVO convert(ProductBrangPageBO result); - -} diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductCategoryConvert.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductCategoryConvert.java deleted file mode 100644 index dab9af54e..000000000 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductCategoryConvert.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.product.application.convert; - -import cn.iocoder.mall.product.api.bo.ProductCategoryBO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryTreeNodeVO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryVO; -import cn.iocoder.mall.product.application.vo.users.UsersProductCategoryVO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -public interface ProductCategoryConvert { - - @Mapper - interface Users { - - Users INSTANCE = Mappers.getMapper(Users.class); - - @Mappings({}) - UsersProductCategoryVO convertToVO(ProductCategoryBO category); - - @Mappings({}) - List convertToVO(List categoryList); - - } - - @Mapper - interface Admins { - - Admins INSTANCE = Mappers.getMapper(Admins.class); - - @Mappings({}) - AdminsProductCategoryTreeNodeVO convert(ProductCategoryBO category); - - @Mappings({}) - AdminsProductCategoryVO convert2(ProductCategoryBO result); - - } - -} diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductBrandVO.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductBrandVO.java deleted file mode 100644 index 3f2a8521a..000000000 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductBrandVO.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.mall.product.application.vo.admins; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 商品品牌 VO - */ - -@ApiModel(value = "商品品牌 VO") -@Data -@Accessors(chain = true) -public class AdminsProductBrandVO { - - /** - * 品牌编号 - */ - @ApiModelProperty(value = "品牌编号", required = true, example = "1") - private Integer id; - - - @ApiModelProperty(value = "名称", required = true, example = "安踏") - private String name; - - - @ApiModelProperty(value = "描述", required = true, example = "安踏拖鞋") - private String description; - - - @ApiModelProperty(value = "图片地址", required = true, example = "http://www.iocoder.cn") - private String picUrl; - - @ApiModelProperty(value = "状态 1-开启 2-禁用", required = true, example = "1") - private Integer status; - -} diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductBrangPageVO.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductBrangPageVO.java deleted file mode 100644 index 266d28427..000000000 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductBrangPageVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.mall.product.application.vo.admins; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.List; - -/** - * 商品品牌分页 BO - */ -@ApiModel("商品品牌分页") -@Data -@Accessors(chain = true) -public class AdminsProductBrangPageVO { - - @ApiModelProperty(value = "品牌数组", required = true) - private List brands; - - - @ApiModelProperty(value = "总数", required = true) - private Integer count; - -} diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductCategoryTreeNodeVO.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductCategoryTreeNodeVO.java deleted file mode 100644 index 6a7b35adc..000000000 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductCategoryTreeNodeVO.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.iocoder.mall.product.application.vo.admins; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; -import java.util.List; - -@ApiModel("产品分类树节点 VO") -@Data -@Accessors(chain = true) -public class AdminsProductCategoryTreeNodeVO { - - @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/images/common/wechat_mp_2017_07_31_bak.jpg") - private String picUrl; - @ApiModelProperty(value = "排序值", required = true, example = "10") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, notes = "1-开启;2-关闭", example = "1") - private Integer status; - @ApiModelProperty(value = "创建时间", required = true, example = "时间戳") - private Date createTime; - @ApiModelProperty(value = "子节点数组") - private List children; - -} diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductCategoryVO.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductCategoryVO.java deleted file mode 100644 index b52374f27..000000000 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductCategoryVO.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.mall.product.application.vo.admins; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -@ApiModel("产品分类 VO") -@Data -@Accessors(chain = true) -public class AdminsProductCategoryVO { - - @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/images/common/wechat_mp_2017_07_31_bak.jpg") - private String picUrl; - @ApiModelProperty(value = "排序值", required = true, example = "10") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, notes = "1-开启;2-关闭", example = "1") - private Integer status; - @ApiModelProperty(value = "创建时间", required = true, example = "时间戳") - private Date createTime; - -} diff --git a/product/product-start/src/main/resources/application-test.yaml b/product/product-start/src/main/resources/application-test.yaml deleted file mode 100644 index 22be4ba61..000000000 --- a/product/product-start/src/main/resources/application-test.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swagger: - enable: true - title: 商品子系统 - description: 商品子系统 - version: 1.0.0 - base-package: cn.iocoder.mall.product.application.controller diff --git a/product/product-start/src/main/resources/application.yaml b/product/product-start/src/main/resources/application.yaml deleted file mode 100644 index a5f4207ce..000000000 --- a/product/product-start/src/main/resources/application.yaml +++ /dev/null @@ -1,34 +0,0 @@ -spring: - application: - name: product-application - - # Spring Cloud 配置项 - cloud: - # Spring Cloud Sentinel 配置项 - sentinel: - transport: - dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址 - eager: true # 项目启动时,直接连接到 Sentinel - -# server -server: - port: 18081 - servlet: - context-path: /product-api/ - - - -management: - endpoints: - web: - exposure: - include: health,info,env,metrics,prometheus - metrics: - enabled: true - -swagger: - enable: true - title: 商品子系统 - description: 商品子系统 - version: 1.0.0 - base-package: cn.iocoder.mall.product.application.controller