mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
【解决todo】修改 image controller 命名
This commit is contained in:
parent
1b725fd517
commit
54b60cd564
@ -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 @fan:import 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:建议把 dallDrawing、midjourney 融合成一个 draw 接口,异步绘制;然后返回一个 id 给前端;前端通过 get 接口轮询,直到获取到生成成功
|
||||
@ -79,11 +64,11 @@ public class AiImageController {
|
||||
return success(null);
|
||||
}
|
||||
|
||||
// TODO @fan:delete-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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user