Skip to content

Commit

Permalink
Merge pull request #120 from IxxP-Girls/modify
Browse files Browse the repository at this point in the history
#20 Fix: DB에서 가져올 때 10개씩 가져오도록 수정
  • Loading branch information
diddnwjd authored Mar 12, 2024
2 parents 696ec0e + 4e9b1f5 commit 6bef0c4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion src/main/java/com/ixxp/culpop/service/CommentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public List<CommentResponse> getComment(User user, int postId, int page) {
int offset = (page - 1) * 10;
List<Comment> 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());
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mapper/comment-mapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit 6bef0c4

Please sign in to comment.