提交 f4146766 编写于 作者: 郝先瑞

refactor: 商品分类API路径修改

上级 cce6b8f2
......@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.web.bind.annotation.*;
......@@ -29,11 +30,11 @@ import java.util.List;
@Api(tags = "「管理端」商品分类")
@RestController
@RequestMapping("/api/v1/categories")
@AllArgsConstructor
@RequiredArgsConstructor
public class PmsCategoryController {
private IPmsCategoryService iPmsCategoryService;
private IPmsAttributeService iPmsAttributeService;
private final IPmsCategoryService iPmsCategoryService;
private final IPmsAttributeService iPmsAttributeService;
@ApiOperation(value = "商品分类列表")
@GetMapping
......@@ -43,9 +44,9 @@ public class PmsCategoryController {
}
@ApiOperation(value = "商品分类级联列表")
@GetMapping("/cascade")
public Result listCascadeCategories() {
List list = iPmsCategoryService.listCascadeCategories();
@GetMapping("/options")
public Result listCategoryOptions() {
List list = iPmsCategoryService.listCategoryOptions();
return Result.success(list);
}
......@@ -82,7 +83,8 @@ public class PmsCategoryController {
@CacheEvict(value = "pms", key = "'categoryList'")
public Result delete(@PathVariable String ids) {
List<String> categoryIds = Arrays.asList(ids.split(","));
iPmsAttributeService.remove(new LambdaQueryWrapper<PmsCategoryAttribute>().in(CollectionUtil.isNotEmpty(categoryIds), PmsCategoryAttribute::getCategoryId, categoryIds));
iPmsAttributeService.remove(new LambdaQueryWrapper<PmsCategoryAttribute>().in(CollectionUtil.isNotEmpty(categoryIds),
PmsCategoryAttribute::getCategoryId, categoryIds));
boolean result = iPmsCategoryService.removeByIds(categoryIds);
return Result.judge(result);
}
......
......@@ -28,7 +28,7 @@ public interface IPmsCategoryService extends IService<PmsCategory> {
* 分类列表(级联)
* @return
*/
List<Option> listCascadeCategories();
List<Option> listCategoryOptions();
/**
......
......@@ -68,7 +68,7 @@ public class PmsCategoryServiceImpl extends ServiceImpl<PmsCategoryMapper, PmsCa
* @return
*/
@Override
public List<Option> listCascadeCategories() {
public List<Option> listCategoryOptions() {
List<PmsCategory> categoryList = this.list(
new LambdaQueryWrapper<PmsCategory>()
.eq(PmsCategory::getVisible, GlobalConstants.STATUS_YES)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册