【增加】获取单个 image 接口

This commit is contained in:
cherishsince 2024-05-28 14:05:44 +08:00
parent e97408b3ac
commit 9878abb03c
4 changed files with 28 additions and 0 deletions

View File

@ -36,6 +36,12 @@ public class AiImageController {
return CommonResult.success(aiImageService.list(req)); return CommonResult.success(aiImageService.list(req));
} }
@Operation(summary = "获取image信息", description = "获取image信息")
@GetMapping("/get")
public CommonResult<AiImageListRespVO> get(@RequestParam("id") Long id) {
return CommonResult.success(aiImageService.get(id));
}
@Operation(summary = "dall2/dall3绘画", description = "openAi dall3是付费的!") @Operation(summary = "dall2/dall3绘画", description = "openAi dall3是付费的!")
@PostMapping("/dall") @PostMapping("/dall")
public AiImageDallRespVO dallDrawing(@Validated @RequestBody AiImageDallReqVO req) { public AiImageDallRespVO dallDrawing(@Validated @RequestBody AiImageDallReqVO req) {

View File

@ -47,6 +47,14 @@ public interface AiImageConvert {
*/ */
List<AiImageListRespVO> convertAiImageListRespVO(List<AiImageDO> list); List<AiImageListRespVO> convertAiImageListRespVO(List<AiImageDO> list);
/**
* 转换 - AiImageListRespVO
*
* @param aiImageDO
* @return
*/
AiImageListRespVO convertAiImageListRespVO(AiImageDO aiImageDO);
/** /**
* 转换 - AiImageMidjourneyOperationsVO * 转换 - AiImageMidjourneyOperationsVO
* *

View File

@ -20,6 +20,14 @@ public interface AiImageService {
*/ */
PageResult<AiImageListRespVO> list(AiImageListReqVO req); PageResult<AiImageListRespVO> list(AiImageListReqVO req);
/**
* 获取 - image 信息
*
* @param id
* @return
*/
AiImageListRespVO get(Long id);
/** /**
* ai绘画 - dall2/dall3 绘画 * ai绘画 - dall2/dall3 绘画
* *

View File

@ -92,6 +92,12 @@ public class AiImageServiceImpl implements AiImageService {
return result; return result;
} }
@Override
public AiImageListRespVO get(Long id) {
AiImageDO aiImageDO = aiImageMapper.selectById(id);
return AiImageConvert.INSTANCE.convertAiImageListRespVO(aiImageDO);
}
@Override @Override
public AiImageDallRespVO dallDrawing(AiImageDallReqVO req) { public AiImageDallRespVO dallDrawing(AiImageDallReqVO req) {
// 保存数据库 // 保存数据库