From e6893db1c3627502f6c9ec94c2551d6fc0e64c39 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 5 May 2022 00:52:25 +0800 Subject: [PATCH] =?UTF-8?q?uniapp=EF=BC=9Acode=20review=20=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=88=86=E7=B1=BB=E3=80=81=E5=95=86=E5=93=81=E5=93=81?= =?UTF-8?q?=E7=89=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/controller/admin/brand/BrandController.java | 1 + .../controller/admin/category/CategoryController.java | 2 ++ .../module/product/dal/dataobject/category/CategoryDO.java | 7 +++++-- .../product/service/category/CategoryServiceImpl.java | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/BrandController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/BrandController.java index 6158a09b9..5658fc22d 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/BrandController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/BrandController.java @@ -68,6 +68,7 @@ public class BrandController { return success(BrandConvert.INSTANCE.convert(brand)); } + // TODO @JeromeSoar:这个接口,是不是没用哈 @GetMapping("/list") @ApiOperation("获得品牌列表") @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/category/CategoryController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/category/CategoryController.java index 9e5614a87..522c5fec7 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/category/CategoryController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/category/CategoryController.java @@ -68,6 +68,7 @@ public class CategoryController { return success(CategoryConvert.INSTANCE.convert(category)); } + // TODO @JeromeSoar:这个接口,是不是没用哈 @GetMapping("/listByIds") @ApiOperation("获得商品分类列表") @PreAuthorize("@ss.hasPermission('product:category:query')") @@ -76,6 +77,7 @@ public class CategoryController { return success(CategoryConvert.INSTANCE.convertList(list)); } + // TODO @JeromeSoar:这应该是个 app 的接口,提供商品分类的树结构。这个调整下,后端只返回列表,前端构建 tree。注意,不需要返回创建时间、是否开启等无关字段。 @GetMapping("/listByQuery") @ApiOperation("获得商品分类列表") @PreAuthorize("@ss.hasPermission('product:category:query')") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/CategoryDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/CategoryDO.java index c788fcc7c..ce52ebf9c 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/CategoryDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/CategoryDO.java @@ -28,6 +28,7 @@ public class CategoryDO extends BaseDO { /** * 父分类编号 */ + // TODO @JeromeSoar:改成 parentId 字段 private Long pid; /** * 分类名称 @@ -38,7 +39,9 @@ public class CategoryDO extends BaseDO { */ private String icon; /** - * 分类图片 + * 分类 Banner 图片 + * + * 第一层的商品分类,会有该字段,用于用户 App 展示 */ private String bannerUrl; /** @@ -51,7 +54,7 @@ public class CategoryDO extends BaseDO { private String description; /** * 开启状态 - *

+ * * 枚举 {@link CommonStatusEnum} */ private Integer status; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/CategoryServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/CategoryServiceImpl.java index b84ac5b9a..4f9ed2c24 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/CategoryServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/CategoryServiceImpl.java @@ -29,6 +29,7 @@ public class CategoryServiceImpl implements CategoryService { @Override public Long createCategory(CategoryCreateReqVO createReqVO) { + // TODO JeromeSoar:校验父分类 // 插入 CategoryDO category = CategoryConvert.INSTANCE.convert(createReqVO); categoryMapper.insert(category); @@ -38,6 +39,7 @@ public class CategoryServiceImpl implements CategoryService { @Override public void updateCategory(CategoryUpdateReqVO updateReqVO) { + // TODO JeromeSoar:校验父分类 // 校验存在 this.validateCategoryExists(updateReqVO.getId()); // 更新 @@ -47,6 +49,8 @@ public class CategoryServiceImpl implements CategoryService { @Override public void deleteCategory(Long id) { + // TODO JeromeSoar:校验删除的商品分类是否存在 + // TODO 芋艿 补充只有不存在商品才可以删除 // 校验存在 this.validateCategoryExists(id); // 删除