Commit e6893db1c3627502f6c9ec94c2551d6fc0e64c39
1 parent
a233ab13
uniapp:code review 商品分类、商品品牌
Showing
4 changed files
with
12 additions
and
2 deletions
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 { | @@ -68,6 +68,7 @@ public class BrandController { | ||
| 68 | return success(BrandConvert.INSTANCE.convert(brand)); | 68 | return success(BrandConvert.INSTANCE.convert(brand)); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | + // TODO @JeromeSoar:这个接口,是不是没用哈 | ||
| 71 | @GetMapping("/list") | 72 | @GetMapping("/list") |
| 72 | @ApiOperation("获得品牌列表") | 73 | @ApiOperation("获得品牌列表") |
| 73 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) | 74 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) |
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 { | @@ -68,6 +68,7 @@ public class CategoryController { | ||
| 68 | return success(CategoryConvert.INSTANCE.convert(category)); | 68 | return success(CategoryConvert.INSTANCE.convert(category)); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | + // TODO @JeromeSoar:这个接口,是不是没用哈 | ||
| 71 | @GetMapping("/listByIds") | 72 | @GetMapping("/listByIds") |
| 72 | @ApiOperation("获得商品分类列表") | 73 | @ApiOperation("获得商品分类列表") |
| 73 | @PreAuthorize("@ss.hasPermission('product:category:query')") | 74 | @PreAuthorize("@ss.hasPermission('product:category:query')") |
| @@ -76,6 +77,7 @@ public class CategoryController { | @@ -76,6 +77,7 @@ public class CategoryController { | ||
| 76 | return success(CategoryConvert.INSTANCE.convertList(list)); | 77 | return success(CategoryConvert.INSTANCE.convertList(list)); |
| 77 | } | 78 | } |
| 78 | 79 | ||
| 80 | + // TODO @JeromeSoar:这应该是个 app 的接口,提供商品分类的树结构。这个调整下,后端只返回列表,前端构建 tree。注意,不需要返回创建时间、是否开启等无关字段。 | ||
| 79 | @GetMapping("/listByQuery") | 81 | @GetMapping("/listByQuery") |
| 80 | @ApiOperation("获得商品分类列表") | 82 | @ApiOperation("获得商品分类列表") |
| 81 | @PreAuthorize("@ss.hasPermission('product:category:query')") | 83 | @PreAuthorize("@ss.hasPermission('product:category:query')") |
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 { | @@ -28,6 +28,7 @@ public class CategoryDO extends BaseDO { | ||
| 28 | /** | 28 | /** |
| 29 | * 父分类编号 | 29 | * 父分类编号 |
| 30 | */ | 30 | */ |
| 31 | + // TODO @JeromeSoar:改成 parentId 字段 | ||
| 31 | private Long pid; | 32 | private Long pid; |
| 32 | /** | 33 | /** |
| 33 | * 分类名称 | 34 | * 分类名称 |
| @@ -38,7 +39,9 @@ public class CategoryDO extends BaseDO { | @@ -38,7 +39,9 @@ public class CategoryDO extends BaseDO { | ||
| 38 | */ | 39 | */ |
| 39 | private String icon; | 40 | private String icon; |
| 40 | /** | 41 | /** |
| 41 | - * 分类图片 | 42 | + * 分类 Banner 图片 |
| 43 | + * | ||
| 44 | + * 第一层的商品分类,会有该字段,用于用户 App 展示 | ||
| 42 | */ | 45 | */ |
| 43 | private String bannerUrl; | 46 | private String bannerUrl; |
| 44 | /** | 47 | /** |
| @@ -51,7 +54,7 @@ public class CategoryDO extends BaseDO { | @@ -51,7 +54,7 @@ public class CategoryDO extends BaseDO { | ||
| 51 | private String description; | 54 | private String description; |
| 52 | /** | 55 | /** |
| 53 | * 开启状态 | 56 | * 开启状态 |
| 54 | - * <p> | 57 | + * |
| 55 | * 枚举 {@link CommonStatusEnum} | 58 | * 枚举 {@link CommonStatusEnum} |
| 56 | */ | 59 | */ |
| 57 | private Integer status; | 60 | private Integer status; |
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 { | @@ -29,6 +29,7 @@ public class CategoryServiceImpl implements CategoryService { | ||
| 29 | 29 | ||
| 30 | @Override | 30 | @Override |
| 31 | public Long createCategory(CategoryCreateReqVO createReqVO) { | 31 | public Long createCategory(CategoryCreateReqVO createReqVO) { |
| 32 | + // TODO JeromeSoar:校验父分类 | ||
| 32 | // 插入 | 33 | // 插入 |
| 33 | CategoryDO category = CategoryConvert.INSTANCE.convert(createReqVO); | 34 | CategoryDO category = CategoryConvert.INSTANCE.convert(createReqVO); |
| 34 | categoryMapper.insert(category); | 35 | categoryMapper.insert(category); |
| @@ -38,6 +39,7 @@ public class CategoryServiceImpl implements CategoryService { | @@ -38,6 +39,7 @@ public class CategoryServiceImpl implements CategoryService { | ||
| 38 | 39 | ||
| 39 | @Override | 40 | @Override |
| 40 | public void updateCategory(CategoryUpdateReqVO updateReqVO) { | 41 | public void updateCategory(CategoryUpdateReqVO updateReqVO) { |
| 42 | + // TODO JeromeSoar:校验父分类 | ||
| 41 | // 校验存在 | 43 | // 校验存在 |
| 42 | this.validateCategoryExists(updateReqVO.getId()); | 44 | this.validateCategoryExists(updateReqVO.getId()); |
| 43 | // 更新 | 45 | // 更新 |
| @@ -47,6 +49,8 @@ public class CategoryServiceImpl implements CategoryService { | @@ -47,6 +49,8 @@ public class CategoryServiceImpl implements CategoryService { | ||
| 47 | 49 | ||
| 48 | @Override | 50 | @Override |
| 49 | public void deleteCategory(Long id) { | 51 | public void deleteCategory(Long id) { |
| 52 | + // TODO JeromeSoar:校验删除的商品分类是否存在 | ||
| 53 | + // TODO 芋艿 补充只有不存在商品才可以删除 | ||
| 50 | // 校验存在 | 54 | // 校验存在 |
| 51 | this.validateCategoryExists(id); | 55 | this.validateCategoryExists(id); |
| 52 | // 删除 | 56 | // 删除 |