From c9bad2cde85df7eb3dad021cf37ec4e592aa2603 Mon Sep 17 00:00:00 2001 From: cloudroam <cloudroam> Date: 星期五, 06 六月 2025 16:01:18 +0800 Subject: [PATCH] fix:返回id --- src/main/java/com/mzl/flower/service/film/impl/CommentServiceImpl.java | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/mzl/flower/service/film/impl/CommentServiceImpl.java b/src/main/java/com/mzl/flower/service/film/impl/CommentServiceImpl.java index e854bb9..ebdd558 100644 --- a/src/main/java/com/mzl/flower/service/film/impl/CommentServiceImpl.java +++ b/src/main/java/com/mzl/flower/service/film/impl/CommentServiceImpl.java @@ -164,7 +164,7 @@ * @return */ @Override - public Boolean create(CommentDTO commentDTO) { + public CommentDTO create(CommentDTO commentDTO) { if (StringUtils.isEmpty(commentDTO.getContent())) { throw new ValidationException("评论内容不能为空"); } @@ -174,9 +174,13 @@ commentPo.setState(true); commentPo.create(SecurityUtils.getUserId()); if (commentPoMapper.insert(commentPo) <= 0) { - throw new ValidationException("添加评论失败"); + CommentDTO commentDTO1 = new CommentDTO(); + return commentDTO1; +// throw new ValidationException("添加评论失败"); } - return true; + BeanUtils.copyProperties(commentPo, commentDTO); + commentDTO.setId(commentPo.getId().intValue()); + return commentDTO; } /** -- Gitblit v1.9.3