From bde1eede2a863f0a0bce8e7954f1cefd65e271ed Mon Sep 17 00:00:00 2001 From: cherishsince Date: Thu, 30 May 2024 10:22:06 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=A7=A3=E5=86=B3todo=E3=80=91image?= =?UTF-8?q?=20delete-my=20=E5=88=A0=E9=99=A4=E8=BF=94=E5=9B=9E=20boolean?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/ai/controller/admin/image/AiImageController.java | 6 ++---- .../yudao/module/ai/service/image/AiImageService.java | 2 +- .../yudao/module/ai/service/image/AiImageServiceImpl.java | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/image/AiImageController.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/image/AiImageController.java index e847cc193..8b279e484 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/image/AiImageController.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/image/AiImageController.java @@ -78,13 +78,11 @@ public class AiImageController { } // TODO @fan:类似 /my-page 的建议 - // TODO @fan:目前如果没结果,返回 Boolean 哈 @Operation(summary = "删除【我的】绘画记录") @DeleteMapping("/delete-my") @Parameter(name = "id", required = true, description = "绘画编号", example = "1024") - public CommonResult deleteMy(@RequestParam("id") Long id) { - aiImageService.deleteMy(id, getLoginUserId()); - return success(null); + public CommonResult deleteMy(@RequestParam("id") Long id) { + return success(aiImageService.deleteMy(id, getLoginUserId())); } } diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageService.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageService.java index 7cb44fa5b..6a374178a 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageService.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageService.java @@ -62,6 +62,6 @@ public interface AiImageService { * @param id * @param loginUserId */ - void deleteMy(Long id, Long loginUserId); + Boolean deleteMy(Long id, Long loginUserId); } diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java index a3494fb20..fc23ed6fb 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java @@ -184,7 +184,7 @@ public class AiImageServiceImpl implements AiImageService { } @Override - public void deleteMy(Long id, Long userId) { + public Boolean deleteMy(Long id, Long userId) { // 校验是否存在,并获取 image AiImageDO image = validateExists(id); // 是否属于当前用户 @@ -192,7 +192,7 @@ public class AiImageServiceImpl implements AiImageService { throw exception(ErrorCodeConstants.AI_IMAGE_NOT_EXISTS); } // 删除记录 - imageMapper.deleteById(id); + return imageMapper.deleteById(id) > 0; } private void validateMessageId(String mjMessageId, String messageId) {