|
|
@@ -0,0 +1,28 @@
|
|
|
+package com.campus.trade.controller;
|
|
|
+
|
|
|
+import com.campus.trade.common.Result;
|
|
|
+import com.campus.trade.entity.Category;
|
|
|
+import com.campus.trade.service.admin.CategoryService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/categories")
|
|
|
+@Tag(name = "Categories", description = "物品分类(公开接口)")
|
|
|
+public class CategoryController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CategoryService categoryService;
|
|
|
+
|
|
|
+ @Operation(summary = "获取所有分类列表", operationId = "listCategories")
|
|
|
+ @GetMapping
|
|
|
+ public Result<List<Category>> list() {
|
|
|
+ return Result.success(categoryService.list());
|
|
|
+ }
|
|
|
+}
|