From 4eb33dda0f123279e9b9507c76c56d47f323472a Mon Sep 17 00:00:00 2001 From: cloudroam <cloudroam> Date: 星期一, 26 五月 2025 16:39:46 +0800 Subject: [PATCH] add:影视作品增加用户信息 --- src/main/java/com/mzl/flower/web/film/FilmCategoryController.java | 98 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 98 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/mzl/flower/web/film/FilmCategoryController.java b/src/main/java/com/mzl/flower/web/film/FilmCategoryController.java new file mode 100644 index 0000000..435bdac --- /dev/null +++ b/src/main/java/com/mzl/flower/web/film/FilmCategoryController.java @@ -0,0 +1,98 @@ +package com.mzl.flower.web.film; + +import com.mzl.flower.base.BaseController; +import com.mzl.flower.base.R; +import com.mzl.flower.base.ReturnDataDTO; +import com.mzl.flower.dto.request.film.FilmCategoryCreateDTO; +import com.mzl.flower.dto.request.film.FilmCategoryUpdateDTO; +import com.mzl.flower.dto.request.film.FilmCategoryQueryDTO; +import com.mzl.flower.dto.response.film.FilmCategoryDTO; +import com.mzl.flower.dto.response.film.FilmCategoryTreeDTO; +import com.mzl.flower.service.film.FilmCategoryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +@RestController +@RequestMapping("/api/film/category") +@Api(value = "片场分类管理", tags = "片场分类管理") +@Validated +@Slf4j +public class FilmCategoryController extends BaseController { + + @Autowired + private FilmCategoryService categoryService; + + @PostMapping("/tree/new") + @ApiOperation(value = "新增片场分类") + public ResponseEntity<ReturnDataDTO> addCategory(@RequestBody FilmCategoryCreateDTO dto) { + return returnData(R.SUCCESS.getCode(), categoryService.addCategory(dto)); + } + + @PostMapping("/tree/edit") + @ApiOperation(value = "编辑片场分类") + public ResponseEntity<ReturnDataDTO> updateCategory(@RequestBody FilmCategoryUpdateDTO dto) { + Long category = categoryService.updateCategory(dto); + return returnData(R.SUCCESS.getCode(), category); + } + + @GetMapping("/tree/view") + @ApiOperation(value = "查询片场分类详情") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "片场分类id", required = true, dataType = "String", paramType = "query") + }) + public ResponseEntity<ReturnDataDTO<FilmCategoryDTO>> getCategory(@NotBlank(message = "id不能为空") String id) { + return returnData(R.SUCCESS.getCode(), categoryService.getCategory(id)); + } + + @GetMapping("/tree") + @ApiOperation(value = "获取片场分类树") + public ResponseEntity<ReturnDataDTO<List<FilmCategoryTreeDTO>>> getCategoryTree(FilmCategoryQueryDTO dto) { + return returnData(R.SUCCESS.getCode(), categoryService.getCategoryTree(dto)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取片场分类列表") + public ResponseEntity<ReturnDataDTO<List<FilmCategoryTreeDTO>>> getCategoryList(FilmCategoryQueryDTO dto) { + return returnData(R.SUCCESS.getCode(), categoryService.getCategoryList(dto)); + } + + @GetMapping("/tree/delete") + @ApiOperation(value = "删除片场分类") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "片场分类id", required = true, dataType = "Long", paramType = "query") + }) + public ResponseEntity<ReturnDataDTO<?>> deleteCategory(Long id) { + categoryService.deleteCategory(id); + return returnData(R.SUCCESS.getCode(), null); + } + + @GetMapping("/tree/shown") + @ApiOperation(value = "显示片场分类") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "片场分类id", required = true, dataType = "Long", paramType = "query") + }) + public ResponseEntity<ReturnDataDTO<?>> showCategory(Long id) { + categoryService.setCategoryShown(id, true); + return returnData(R.SUCCESS.getCode(), null); + } + + @GetMapping("/tree/hidden") + @ApiOperation(value = "隐藏片场分类") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "片场分类id", required = true, dataType = "Long", paramType = "query") + }) + public ResponseEntity<ReturnDataDTO<?>> hideCategory(Long id) { + categoryService.setCategoryShown(id, false); + return returnData(R.SUCCESS.getCode(), null); + } +} \ No newline at end of file -- Gitblit v1.9.3