【解决todo】image delete-my 删除返回 boolean
This commit is contained in:
parent
1c0cf4b860
commit
bde1eede2a
|
@ -78,13 +78,11 @@ public class AiImageController {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @fan:类似 /my-page 的建议
|
// TODO @fan:类似 /my-page 的建议
|
||||||
// TODO @fan:目前如果没结果,返回 Boolean 哈
|
|
||||||
@Operation(summary = "删除【我的】绘画记录")
|
@Operation(summary = "删除【我的】绘画记录")
|
||||||
@DeleteMapping("/delete-my")
|
@DeleteMapping("/delete-my")
|
||||||
@Parameter(name = "id", required = true, description = "绘画编号", example = "1024")
|
@Parameter(name = "id", required = true, description = "绘画编号", example = "1024")
|
||||||
public CommonResult<Void> deleteMy(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> deleteMy(@RequestParam("id") Long id) {
|
||||||
aiImageService.deleteMy(id, getLoginUserId());
|
return success(aiImageService.deleteMy(id, getLoginUserId()));
|
||||||
return success(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,6 @@ public interface AiImageService {
|
||||||
* @param id
|
* @param id
|
||||||
* @param loginUserId
|
* @param loginUserId
|
||||||
*/
|
*/
|
||||||
void deleteMy(Long id, Long loginUserId);
|
Boolean deleteMy(Long id, Long loginUserId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ public class AiImageServiceImpl implements AiImageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteMy(Long id, Long userId) {
|
public Boolean deleteMy(Long id, Long userId) {
|
||||||
// 校验是否存在,并获取 image
|
// 校验是否存在,并获取 image
|
||||||
AiImageDO image = validateExists(id);
|
AiImageDO image = validateExists(id);
|
||||||
// 是否属于当前用户
|
// 是否属于当前用户
|
||||||
|
@ -192,7 +192,7 @@ public class AiImageServiceImpl implements AiImageService {
|
||||||
throw exception(ErrorCodeConstants.AI_IMAGE_NOT_EXISTS);
|
throw exception(ErrorCodeConstants.AI_IMAGE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 删除记录
|
// 删除记录
|
||||||
imageMapper.deleteById(id);
|
return imageMapper.deleteById(id) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateMessageId(String mjMessageId, String messageId) {
|
private void validateMessageId(String mjMessageId, String messageId) {
|
||||||
|
|
Loading…
Reference in New Issue