From 4e9b1f559e78ddeb25bc8d90324bdcb90fe1f03b Mon Sep 17 00:00:00 2001 From: diddnwjd Date: Tue, 12 Mar 2024 18:43:44 +0900 Subject: [PATCH] =?UTF-8?q?#20=20Fix:=20DB=EC=97=90=EC=84=9C=20=EA=B0=80?= =?UTF-8?q?=EC=A0=B8=EC=98=AC=20=EB=95=8C=2010=EA=B0=9C=EC=94=A9=20?= =?UTF-8?q?=EA=B0=80=EC=A0=B8=EC=98=A4=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ixxp/culpop/service/CommentService.java | 1 - src/main/resources/mapper/comment-mapper.xml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/ixxp/culpop/service/CommentService.java b/src/main/java/com/ixxp/culpop/service/CommentService.java index 2a0f198..e8c9f6d 100644 --- a/src/main/java/com/ixxp/culpop/service/CommentService.java +++ b/src/main/java/com/ixxp/culpop/service/CommentService.java @@ -50,7 +50,6 @@ public List getComment(User user, int postId, int page) { int offset = (page - 1) * 10; List comments = commentMapper.selectComment(postId, offset); return comments.stream() - .filter(comment -> comment.getParentId() == 0) .map(comment -> { boolean likeCheck = (user != null) && commentLikeMapper.checkCommentLike(user.getId(), comment.getId()); int likeCount = commentLikeMapper.countLikesByCommentId(comment.getId()); diff --git a/src/main/resources/mapper/comment-mapper.xml b/src/main/resources/mapper/comment-mapper.xml index 5029f43..fb46c66 100644 --- a/src/main/resources/mapper/comment-mapper.xml +++ b/src/main/resources/mapper/comment-mapper.xml @@ -33,7 +33,7 @@ SELECT c.id, c.content, c.secret, c.parentId, c.createdAt, u.id AS userId, u.username FROM Comment c LEFT JOIN User u ON c.userId = u.id - WHERE c.postId=#{postId} + WHERE c.postId=#{postId} AND c.parentId = 0 GROUP BY c.id, c.content, c.secret, c.parentId, c.createdAt, u.id, u.username ORDER BY c.createdAt LIMIT 10 OFFSET #{offset};