Commit e0d53782 authored by 刘基明's avatar 刘基明

递归删除评论的回复 fix

parent 647df1e7
......@@ -241,8 +241,9 @@ public class CommentManager {
ThemeEntity themeEntity = themeService.queryByThemeId(commentEntity.getThemeId());
notificationService.deleteCommentNotify(themeEntity.getAuthorId(), userId, commentId, commentEntity.getCreateTime());
// 递归
commentId = commentEntity.getReplyId();
userId = commentEntity.getReplyUserId();
CommentEntity replyForComment =commentService.queryReplyForComment(commentId);
commentId = replyForComment.getCommentId();
userId = replyForComment.getAuthorId();
}
}
......
......@@ -224,4 +224,20 @@ public class CommentService {
}
}
/**
* 获取对该评论的回复,如果没有则返回空对象
* @param commentId
* @return
*/
public CommentEntity queryReplyForComment(String commentId) {
List<CommentEntity> replies = commentMapper.selectList(new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getReplyId, commentId)
.eq(CommentEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED));
if (CollectionUtils.isEmpty(replies)){
return replies.get(0);
}else {
return new CommentEntity();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment