|
@@ -2,6 +2,7 @@ package com.atguigu.tingshu.album.api;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.atguigu.tingshu.album.service.BaseCategoryService;
|
|
|
+import com.atguigu.tingshu.common.cache.GuiGuCache;
|
|
|
import com.atguigu.tingshu.common.result.Result;
|
|
|
import com.atguigu.tingshu.model.album.BaseAttribute;
|
|
|
import com.atguigu.tingshu.model.album.BaseCategory1;
|
|
@@ -36,6 +37,7 @@ public class BaseCategoryApiController {
|
|
|
*/
|
|
|
@Operation(summary = "查询所有1,2,3级分类数据")
|
|
|
@GetMapping("/category/getBaseCategoryList")
|
|
|
+ @GuiGuCache(prefix = "album:category:all")
|
|
|
public Result<List<JSONObject>> getBaseCategoryList() {
|
|
|
List<JSONObject> list = baseCategoryService.getBaseCategoryList();
|
|
|
return Result.ok(list);
|
|
@@ -49,6 +51,7 @@ public class BaseCategoryApiController {
|
|
|
*/
|
|
|
@Operation(summary = "根据一级分类Id获取分类标签以及标签值")
|
|
|
@GetMapping("/category/findAttribute/{category1Id}")
|
|
|
+ @GuiGuCache(prefix = "album:category:attribute:")
|
|
|
public Result<List<BaseAttribute>> findAttributeByCategory1Id(@PathVariable("category1Id") Long category1Id) {
|
|
|
List<BaseAttribute> list = baseCategoryService.findAttributeByCategory1Id(category1Id);
|
|
|
return Result.ok(list);
|
|
@@ -62,6 +65,7 @@ public class BaseCategoryApiController {
|
|
|
*/
|
|
|
@Operation(summary = "根据三级分类ID查询分类信息")
|
|
|
@GetMapping("/category/getCategoryView/{category3Id}")
|
|
|
+ @GuiGuCache(prefix = "album:category:category3:")
|
|
|
public Result<BaseCategoryView> getCategoryView(@PathVariable("category3Id") Long category3Id) {
|
|
|
BaseCategoryView baseCategoryView = baseCategoryService.getCategoryView(category3Id);
|
|
|
return Result.ok(baseCategoryView);
|
|
@@ -74,6 +78,7 @@ public class BaseCategoryApiController {
|
|
|
*/
|
|
|
@Operation(summary = "根据1级分类ID查询置顶7个三级分类列表")
|
|
|
@GetMapping("/category/findTopBaseCategory3/{category1Id}")
|
|
|
+ @GuiGuCache(prefix = "album:category:top3:")
|
|
|
public Result<List<BaseCategory3>> findTopBaseCategory3(@PathVariable("category1Id") Long category1Id) {
|
|
|
List<BaseCategory3> list = baseCategoryService.findTopBaseCategory3(category1Id);
|
|
|
return Result.ok(list);
|
|
@@ -87,6 +92,7 @@ public class BaseCategoryApiController {
|
|
|
*/
|
|
|
@Operation(summary = "根据1级分类ID查询到1级分类对象(包含所属二级分类,所属三级分类列表)")
|
|
|
@GetMapping("/category/getBaseCategoryList/{category1Id}")
|
|
|
+ @GuiGuCache(prefix = "album:category:")
|
|
|
public Result<JSONObject> getBaseCategoryListByCategory1Id(@PathVariable("category1Id") Long category1Id) {
|
|
|
JSONObject jsonObject = baseCategoryService.getBaseCategoryListByCategory1Id(category1Id);
|
|
|
return Result.ok(jsonObject);
|
|
@@ -99,6 +105,7 @@ public class BaseCategoryApiController {
|
|
|
*/
|
|
|
@Operation(summary = "查询所有一级分类列表")
|
|
|
@GetMapping("/category/findAllCategory1")
|
|
|
+ @GuiGuCache(prefix = "album:category:category1")
|
|
|
public Result<List<BaseCategory1>> getAllCategory1() {
|
|
|
LambdaQueryWrapper<BaseCategory1> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.select(BaseCategory1::getId);
|