mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
uniapp:code review 商品分类、商品品牌
This commit is contained in:
parent
a233ab1395
commit
e6893db1c3
@ -68,6 +68,7 @@ public class BrandController {
|
|||||||
return success(BrandConvert.INSTANCE.convert(brand));
|
return success(BrandConvert.INSTANCE.convert(brand));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO @JeromeSoar:这个接口,是不是没用哈
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperation("获得品牌列表")
|
@ApiOperation("获得品牌列表")
|
||||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
||||||
|
@ -68,6 +68,7 @@ public class CategoryController {
|
|||||||
return success(CategoryConvert.INSTANCE.convert(category));
|
return success(CategoryConvert.INSTANCE.convert(category));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO @JeromeSoar:这个接口,是不是没用哈
|
||||||
@GetMapping("/listByIds")
|
@GetMapping("/listByIds")
|
||||||
@ApiOperation("获得商品分类列表")
|
@ApiOperation("获得商品分类列表")
|
||||||
@PreAuthorize("@ss.hasPermission('product:category:query')")
|
@PreAuthorize("@ss.hasPermission('product:category:query')")
|
||||||
@ -76,6 +77,7 @@ public class CategoryController {
|
|||||||
return success(CategoryConvert.INSTANCE.convertList(list));
|
return success(CategoryConvert.INSTANCE.convertList(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO @JeromeSoar:这应该是个 app 的接口,提供商品分类的树结构。这个调整下,后端只返回列表,前端构建 tree。注意,不需要返回创建时间、是否开启等无关字段。
|
||||||
@GetMapping("/listByQuery")
|
@GetMapping("/listByQuery")
|
||||||
@ApiOperation("获得商品分类列表")
|
@ApiOperation("获得商品分类列表")
|
||||||
@PreAuthorize("@ss.hasPermission('product:category:query')")
|
@PreAuthorize("@ss.hasPermission('product:category:query')")
|
||||||
|
@ -28,6 +28,7 @@ public class CategoryDO extends BaseDO {
|
|||||||
/**
|
/**
|
||||||
* 父分类编号
|
* 父分类编号
|
||||||
*/
|
*/
|
||||||
|
// TODO @JeromeSoar:改成 parentId 字段
|
||||||
private Long pid;
|
private Long pid;
|
||||||
/**
|
/**
|
||||||
* 分类名称
|
* 分类名称
|
||||||
@ -38,7 +39,9 @@ public class CategoryDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String icon;
|
private String icon;
|
||||||
/**
|
/**
|
||||||
* 分类图片
|
* 分类 Banner 图片
|
||||||
|
*
|
||||||
|
* 第一层的商品分类,会有该字段,用于用户 App 展示
|
||||||
*/
|
*/
|
||||||
private String bannerUrl;
|
private String bannerUrl;
|
||||||
/**
|
/**
|
||||||
@ -51,7 +54,7 @@ public class CategoryDO extends BaseDO {
|
|||||||
private String description;
|
private String description;
|
||||||
/**
|
/**
|
||||||
* 开启状态
|
* 开启状态
|
||||||
* <p>
|
*
|
||||||
* 枚举 {@link CommonStatusEnum}
|
* 枚举 {@link CommonStatusEnum}
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
@ -29,6 +29,7 @@ public class CategoryServiceImpl implements CategoryService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createCategory(CategoryCreateReqVO createReqVO) {
|
public Long createCategory(CategoryCreateReqVO createReqVO) {
|
||||||
|
// TODO JeromeSoar:校验父分类
|
||||||
// 插入
|
// 插入
|
||||||
CategoryDO category = CategoryConvert.INSTANCE.convert(createReqVO);
|
CategoryDO category = CategoryConvert.INSTANCE.convert(createReqVO);
|
||||||
categoryMapper.insert(category);
|
categoryMapper.insert(category);
|
||||||
@ -38,6 +39,7 @@ public class CategoryServiceImpl implements CategoryService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateCategory(CategoryUpdateReqVO updateReqVO) {
|
public void updateCategory(CategoryUpdateReqVO updateReqVO) {
|
||||||
|
// TODO JeromeSoar:校验父分类
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validateCategoryExists(updateReqVO.getId());
|
this.validateCategoryExists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
@ -47,6 +49,8 @@ public class CategoryServiceImpl implements CategoryService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteCategory(Long id) {
|
public void deleteCategory(Long id) {
|
||||||
|
// TODO JeromeSoar:校验删除的商品分类是否存在
|
||||||
|
// TODO 芋艿 补充只有不存在商品才可以删除
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validateCategoryExists(id);
|
this.validateCategoryExists(id);
|
||||||
// 删除
|
// 删除
|
||||||
|
Loading…
Reference in New Issue
Block a user