【解决todo】修改 image controller 命名

This commit is contained in:
cherishsince 2024-05-29 10:29:32 +08:00
parent 1b725fd517
commit 54b60cd564

View File

@ -6,48 +6,33 @@ import cn.iocoder.yudao.module.ai.controller.admin.image.vo.*;
import cn.iocoder.yudao.module.ai.service.image.AiImageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
// TODO @芋艿整理接口定义
// TODO @fan参考 AiChatMessageController 改下 swagger 注解注释
/**
* ai作图
*
* @author fansili
* @time 2024/4/25 15:49
* @since 1.0
*/
@Tag(name = "A10-ai作图")
@Tag(name = "管理后台 - Ai 绘画")
@RestController
@RequestMapping("/ai/image")
@Slf4j
@AllArgsConstructor
public class AiImageController {
// TODO @fan使用 @Resource 注入哈然后 aiImageService => imageService
private final AiImageService aiImageService;
@Resource
private AiImageService aiImageService;
// TODO @fan分页列表建议是 getImagePage包括接口 path 也建议改下哈
// TODO @fan@ModelAttribute 不需要哈
// TODO @fan这个要不搞成 my-page因为是我的哈
@Operation(summary = "获取image列表", description = "dall3、midjourney")
@GetMapping("/list")
public CommonResult<PageResult<AiImageListRespVO>> list(@Validated @ModelAttribute AiImageListReqVO req) {
// TODO @fanimport static这样只要 success() 就行啦
return CommonResult.success(aiImageService.list(req));
@Operation(summary = "获取 - 我的分页列表", description = "dall3、midjourney")
@GetMapping("/my-page")
public CommonResult<PageResult<AiImageListRespVO>> myPage(@Validated AiImageListReqVO req) {
return success(aiImageService.list(req));
}
// TODO @fan搞成 get-my
// TODO @fan方法名改下哈
@Operation(summary = "获取image信息", description = "获取image信息")
@GetMapping("/get")
public CommonResult<AiImageListRespVO> get(@RequestParam("id") Long id) {
return CommonResult.success(aiImageService.get(id));
@Operation(summary = "获取 - 我的 image 信息", description = "...")
@GetMapping("/get-my")
public CommonResult<AiImageListRespVO> getMy(@RequestParam("id") Long id) {
return CommonResult.success(aiImageService.getMy(id));
}
// TODO @fan建议把 dallDrawingmidjourney 融合成一个 draw 接口异步绘制然后返回一个 id 给前端前端通过 get 接口轮询直到获取到生成成功
@ -79,11 +64,11 @@ public class AiImageController {
return success(null);
}
// TODO @fandelete-my需要校验是不是当前人哈
@Operation(summary = "删除绘画记录", description = "")
@DeleteMapping("/delete")
public CommonResult<Void> delete(@RequestParam("id") Long id) {
aiImageService.delete(id);
@DeleteMapping("/delete-my")
public CommonResult<Void> deleteMy(@RequestParam("id") Long id) {
Long loginUserId = getLoginUserId();
aiImageService.deleteMy(id, loginUserId);
return success(null);
}