【解决todo】image delete-my 删除返回 boolean

This commit is contained in:
cherishsince 2024-05-30 10:22:06 +08:00
parent 1c0cf4b860
commit bde1eede2a
3 changed files with 5 additions and 7 deletions

View File

@ -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<Void> deleteMy(@RequestParam("id") Long id) {
aiImageService.deleteMy(id, getLoginUserId());
return success(null);
public CommonResult<Boolean> deleteMy(@RequestParam("id") Long id) {
return success(aiImageService.deleteMy(id, getLoginUserId()));
}
}

View File

@ -62,6 +62,6 @@ public interface AiImageService {
* @param id
* @param loginUserId
*/
void deleteMy(Long id, Long loginUserId);
Boolean deleteMy(Long id, Long loginUserId);
}

View File

@ -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) {