From 3595c02e744845d321f9aec361831fa60cda3841 Mon Sep 17 00:00:00 2001 From: Klaus Date: Sat, 22 Mar 2025 06:37:20 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EB=B0=A9=20-=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=97=86=EC=9D=B4=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/live/room/LiveRoomRepository.kt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt index 9a32539..a648fe2 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt @@ -176,18 +176,24 @@ class LiveRoomQueryRepositoryImpl( ) } - return queryFactory - .selectFrom(liveRoom) - .innerJoin(liveRoom.member, member) - .limit(10) - .where(where) - .orderBy( + val orderBy = if (memberId != null) { + listOf( CaseBuilder() .`when`(member.id.eq(memberId)).then(1) .otherwise(2) .asc(), liveRoom.beginDateTime.asc() ) + } else { + listOf(liveRoom.beginDateTime.asc()) + } + + return queryFactory + .selectFrom(liveRoom) + .innerJoin(liveRoom.member, member) + .limit(10) + .where(where) + .orderBy(*orderBy.toTypedArray()) .fetch() }