|
@@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 分类接口
|
|
* 分类接口
|
|
*
|
|
*
|
|
@@ -77,4 +79,24 @@ public class CategoryController {
|
|
public void deleteCategory(@PathVariable("id") @Min(value = 1, message = "分类主键不能小于1") Long id) {
|
|
public void deleteCategory(@PathVariable("id") @Min(value = 1, message = "分类主键不能小于1") Long id) {
|
|
this.categoryService.deleteCategory(id);
|
|
this.categoryService.deleteCategory(id);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取分类列表
|
|
|
|
+ *
|
|
|
|
+ * @return 分类信息列表
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/categories")
|
|
|
|
+ public List<CategoryDTO> listCategories() {
|
|
|
|
+ return this.categoryService.listActiveCategories();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取一级分类列表
|
|
|
|
+ *
|
|
|
|
+ * @return 分类信息列表
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/getRootCategories")
|
|
|
|
+ public List<CategoryDTO> getRootCategories() {
|
|
|
|
+ return this.categoryService.getRootCategories();
|
|
|
|
+ }
|
|
}
|
|
}
|