完善了商品类别接口

This commit is contained in:
chen-xin-zhi 2024-10-31 19:57:15 +08:00
parent 4eb5453a0a
commit 45ff92ae85

View File

@ -17,11 +17,13 @@ import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -106,6 +108,21 @@ public class CategoryController {
}
/**
* 查询所有商品类别
* @return 商品类别列表
*/
@PostMapping("/list")
public BaseResponse<List<Category>> listCategory() {
List<Category> list = categoryService.list();
if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
return ResultUtils.success(list);
}
/**
* 根据类别查询商品列表
* @param categoryQueryRequest 类别查询请求体