refactor: 商品分类API路径修改

This commit is contained in:
郝先瑞 2022-07-11 23:56:48 +08:00
parent cce6b8f23f
commit f41467669f
3 changed files with 11 additions and 9 deletions

View File

@ -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);
}

View File

@ -28,7 +28,7 @@ public interface IPmsCategoryService extends IService<PmsCategory> {
* 分类列表级联
* @return
*/
List<Option> listCascadeCategories();
List<Option> listCategoryOptions();
/**

View File

@ -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)