Commit e6893db1c3627502f6c9ec94c2551d6fc0e64c39

Authored by YunaiV
1 parent a233ab13

uniapp:code review 商品分类、商品品牌

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