diff --git a/src/main/java/io/oeid/mogakgo/domain/profile/infrastructure/ProfileCardLikeRepositoryCustomImpl.java b/src/main/java/io/oeid/mogakgo/domain/profile/infrastructure/ProfileCardLikeRepositoryCustomImpl.java index c98d0faf..cb265bb4 100644 --- a/src/main/java/io/oeid/mogakgo/domain/profile/infrastructure/ProfileCardLikeRepositoryCustomImpl.java +++ b/src/main/java/io/oeid/mogakgo/domain/profile/infrastructure/ProfileCardLikeRepositoryCustomImpl.java @@ -58,6 +58,8 @@ public CursorPaginationResult getLikeInfoBySender( cursorIdCondition(pageable.getCursorId()), senderIdEq(senderId) ) + // 최근순 + .orderBy(profileCardLike.id.desc()) .limit(pageable.getPageSize() + 1) .fetch(); @@ -83,6 +85,6 @@ private BooleanExpression receiveridEq(Long receiverId) { } private BooleanExpression cursorIdCondition(Long cursorId) { - return cursorId != null ? profileCardLike.id.gt(cursorId) : null; + return cursorId != null ? profileCardLike.id.lt(cursorId) : null; } } diff --git a/src/main/java/io/oeid/mogakgo/domain/profile/infrastructure/ProfileCardRepositoryCustomImpl.java b/src/main/java/io/oeid/mogakgo/domain/profile/infrastructure/ProfileCardRepositoryCustomImpl.java index a8d898d6..7684dd55 100644 --- a/src/main/java/io/oeid/mogakgo/domain/profile/infrastructure/ProfileCardRepositoryCustomImpl.java +++ b/src/main/java/io/oeid/mogakgo/domain/profile/infrastructure/ProfileCardRepositoryCustomImpl.java @@ -35,6 +35,8 @@ public CursorPaginationResult findByConditionWithPaginati regionEq(region), deletedProfileCardEq() ) + // 최근순 + .orderBy(profileCard.id.desc()) .limit(pageable.getPageSize() + 1) .fetch(); @@ -69,7 +71,7 @@ private BooleanExpression userIdEq(Long userId) { } private BooleanExpression cursorIdCondition(Long cursorId) { - return cursorId != null ? profileCard.id.gt(cursorId) : null; + return cursorId != null ? profileCard.id.lt(cursorId) : null; } private BooleanExpression deletedProfileCardEq() { diff --git a/src/main/java/io/oeid/mogakgo/domain/project/infrastructure/ProjectRepositoryCustomImpl.java b/src/main/java/io/oeid/mogakgo/domain/project/infrastructure/ProjectRepositoryCustomImpl.java index 20c73887..c407159b 100644 --- a/src/main/java/io/oeid/mogakgo/domain/project/infrastructure/ProjectRepositoryCustomImpl.java +++ b/src/main/java/io/oeid/mogakgo/domain/project/infrastructure/ProjectRepositoryCustomImpl.java @@ -43,6 +43,8 @@ public CursorPaginationResult findByConditionWithPagination projectStatusEq(projectStatus), createdAtEq(today) ) + // 최근순 + .orderBy(project.id.desc()) .limit(pageable.getPageSize() + 1) .fetch(); @@ -90,7 +92,7 @@ public List getDensityRankProjectsByRegion(int limit) { } private BooleanExpression cursorIdCondition(Long cursorId) { - return cursorId != null ? project.id.gt(cursorId) : null; + return cursorId != null ? project.id.lt(cursorId) : null; } private BooleanExpression userIdEq(Long userId) { diff --git a/src/main/java/io/oeid/mogakgo/domain/project_join_req/infrastructure/ProjectJoinRequestRepositoryCustomImpl.java b/src/main/java/io/oeid/mogakgo/domain/project_join_req/infrastructure/ProjectJoinRequestRepositoryCustomImpl.java index a2e05315..3114f1ef 100644 --- a/src/main/java/io/oeid/mogakgo/domain/project_join_req/infrastructure/ProjectJoinRequestRepositoryCustomImpl.java +++ b/src/main/java/io/oeid/mogakgo/domain/project_join_req/infrastructure/ProjectJoinRequestRepositoryCustomImpl.java @@ -84,11 +84,13 @@ public CursorPaginationResult getBySenderIdWithP ) { List entities = jpaQueryFactory.selectFrom(projectJoinRequest) .where( - cursorIdCondition(pageable.getCursorId()), + cursorIdConditionForDesc(pageable.getCursorId()), senderIdEq(senderId), projectIdEq(projectId), requestStatusEq(requestStatus) ) + // 최근순 + .orderBy(projectJoinRequest.id.desc()) .limit(pageable.getPageSize() + 1) .fetch(); @@ -125,4 +127,8 @@ private BooleanExpression cursorIdCondition(Long cursorId) { return cursorId != null ? projectJoinRequest.id.gt(cursorId) : null; } + private BooleanExpression cursorIdConditionForDesc(Long cursorId) { + return cursorId != null ? projectJoinRequest.id.lt(cursorId) : null; + } + }