package com.mzl.flower.web.film; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.base.BaseController; import com.mzl.flower.base.R; import com.mzl.flower.base.ReturnDataDTO; import com.mzl.flower.constant.Constants; import com.mzl.flower.dto.request.film.AiContentTaskConfigDTO; import com.mzl.flower.dto.request.film.AiContentTaskConfigQueryDTO; import com.mzl.flower.dto.response.film.AiContentTaskConfigVO; import com.mzl.flower.schedule.TaskExecutor; import com.mzl.flower.service.film.AiContentTaskConfigService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.validation.constraints.NotNull; import java.util.List; /** * @author fanghaowei * @version version2.0 * @className FilmWorksController * @date 2024/8/26 * @description 模型任务配置 */ @Api(value = "模型任务配置", tags = "模型任务配置") @RestController @RequestMapping("/api") @RequiredArgsConstructor public class AiContentTaskConfigController extends BaseController { private final AiContentTaskConfigService aiContentTaskConfigService; private final TaskExecutor taskExecutor; @GetMapping("/aiTaskConfig/all") @ApiOperation(value = "模型任务配置列表", httpMethod = "GET") public ResponseEntity>> getFilmWorksAll() { return returnData(R.SUCCESS.getCode(), aiContentTaskConfigService.getEnabledAiContentTaskConfig()); } @GetMapping("/aiTaskConfig/list") @ApiOperation(value = "模型任务配置列表", httpMethod = "GET") public ResponseEntity>> getFilmWorksList(Page page, AiContentTaskConfigQueryDTO dto) { dto.setType(Constants.GENERATOR_CONTENT.film_content.name()); return returnData(R.SUCCESS.getCode(), aiContentTaskConfigService.queryPage(dto, page)); } @GetMapping(value = "/aiTaskConfig/delete") @ApiOperation(value = "删除模型任务配置 ", httpMethod = "GET", notes = "ID") public ResponseEntity delete(@NotNull(message = "id不能为空") Long id) { aiContentTaskConfigService.deleteAiContentTaskConfig(String.valueOf(id)); return returnData(R.SUCCESS.getCode(), null); } @PostMapping(value = "/aiTaskConfig/new") @ApiOperation(value = "保存模型任务配置", httpMethod = "POST") public ResponseEntity insert(@RequestBody AiContentTaskConfigDTO aiContentTaskConfigDTO) { aiContentTaskConfigDTO.setType(Constants.GENERATOR_CONTENT.film_content.name()); aiContentTaskConfigService.saveAiContentTaskConfig(aiContentTaskConfigDTO); return returnData(R.SUCCESS.getCode(), null); } @PostMapping(value = "/aiTaskConfig/edit") @ApiOperation(value = "更新模型任务配置", httpMethod = "POST") public ResponseEntity update(@RequestBody AiContentTaskConfigDTO aiContentTaskConfigDTO) { aiContentTaskConfigService.updateAiContentTaskConfig(aiContentTaskConfigDTO); return returnData(R.SUCCESS.getCode(), null); } @GetMapping("/aiTaskConfig/list/view") @ApiOperation(value = "详情", notes = "详情") public ResponseEntity> detail(@NotNull(message = "id不能为空") Long id) { return returnData(R.SUCCESS.getCode(),aiContentTaskConfigService.detail(id)); } }