From f4ed588d33ec391071ec4b85063c04218dffd7fa Mon Sep 17 00:00:00 2001 From: zxcv9203 <41960243+zxcv9203@users.noreply.github.com> Date: Sun, 14 Aug 2022 22:18:31 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20:=20=EB=8C=93=EA=B8=80=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EC=8B=9C=20=EC=88=9C=EC=84=9C=EA=B0=80=20?= =?UTF-8?q?=EB=92=A4=EC=A3=BD=EB=B0=95=EC=A3=BD=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EB=90=98=EB=8A=94=20=ED=98=84=EC=83=81=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0=20(#245)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 여러명의 유저가 댓글을 작성시 일정 개수가 넘어져서 결과가 댓글 작성순이 아닌 뒤죽박죽 섞여서 나오는 현상이 발생 값을 DB에 조회할때 orderby를 통해 댓글 최신 작성순으로 정렬하도록 로직 추가 --- .../comment/repository/CustomCommentRepositoryImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/devcourse/checkmoi/domain/comment/repository/CustomCommentRepositoryImpl.java b/src/main/java/com/devcourse/checkmoi/domain/comment/repository/CustomCommentRepositoryImpl.java index e9c6f23..a9d5a5f 100644 --- a/src/main/java/com/devcourse/checkmoi/domain/comment/repository/CustomCommentRepositoryImpl.java +++ b/src/main/java/com/devcourse/checkmoi/domain/comment/repository/CustomCommentRepositoryImpl.java @@ -6,7 +6,6 @@ import com.querydsl.core.types.Projections; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.JPQLQuery; -import com.querydsl.jpa.impl.JPAQuery; import com.querydsl.jpa.impl.JPAQueryFactory; import java.util.List; import lombok.RequiredArgsConstructor; @@ -39,7 +38,8 @@ public Page findAllByCondition(Search request, Pageable pageable) { .from(comment) .where( eqPostId(request.postId()) - ); + ) + .orderBy(comment.createdAt.asc()); long totalCount = query.fetchCount(); List comments = query .offset(pageable.getOffset())