From 04be33a2fa8cc9d0aee27dc1161147197ebda84e Mon Sep 17 00:00:00 2001 From: wjdtkdgns Date: Mon, 18 Nov 2024 23:00:42 +0900 Subject: [PATCH 1/3] v1.1.24-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index fea8b85a..5dfff60c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version=1.1.23-SNAPSHOT +version=1.1.24-SNAPSHOT kotlin.code.style=official From 11b834e62e0b7b3310586dc91eb6bf35175f0ce1 Mon Sep 17 00:00:00 2001 From: DongGeon0908 Date: Thu, 21 Nov 2024 08:41:01 +0900 Subject: [PATCH 2/3] fix: fix querydsl extension --- .../common/extension/QueryDslExtension.kt | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/domain/src/main/kotlin/com/oksusu/susu/domain/common/extension/QueryDslExtension.kt b/domain/src/main/kotlin/com/oksusu/susu/domain/common/extension/QueryDslExtension.kt index 0cd2ed1e..e9ecad57 100644 --- a/domain/src/main/kotlin/com/oksusu/susu/domain/common/extension/QueryDslExtension.kt +++ b/domain/src/main/kotlin/com/oksusu/susu/domain/common/extension/QueryDslExtension.kt @@ -18,29 +18,27 @@ import org.springframework.data.jpa.repository.support.Querydsl import java.time.LocalDateTime fun Querydsl?.execute(query: JPAQuery, pageable: Pageable): Page { - return this.takeUnless { querydsl -> querydsl == null } - ?.let { queryDsl -> - queryDsl.applyPagination(pageable, query).run { - PageImpl(this.fetch(), pageable, this.fetchCount()) - } - } ?: throw SusuException(ErrorCode.QUERY_DSL_NOT_EXISTS_ERROR) + return this?.let { queryDsl -> + queryDsl.applyPagination(pageable, query).run { + PageImpl(this.fetch(), pageable, this.fetchCount()) + } + } ?: throw SusuException(ErrorCode.QUERY_DSL_NOT_EXISTS_ERROR) } fun Querydsl?.executeSlice(query: JPAQuery, pageable: Pageable): Slice { - return this.takeUnless { querydsl -> querydsl == null } - ?.let { queryDsl -> - queryDsl.applyPagination(pageable, query).run { - this.limit(pageable.pageSize + 1L) - .fetch() - }.run { - var hasNext = false - if (this.size > pageable.pageSize) { - hasNext = true - this.removeAt(pageable.pageSize) - } - SliceImpl(this, pageable, hasNext) + return this?.let { queryDsl -> + queryDsl.applyPagination(pageable, query).run { + this.limit(pageable.pageSize + 1L) + .fetch() + }.run { + var hasNext = false + if (this.size > pageable.pageSize) { + hasNext = true + this.removeAt(pageable.pageSize) } - } ?: throw SusuException(ErrorCode.QUERY_DSL_NOT_EXISTS_ERROR) + SliceImpl(this, pageable, hasNext) + } + } ?: throw SusuException(ErrorCode.QUERY_DSL_NOT_EXISTS_ERROR) } fun StringPath.isEquals(parameter: String?): BooleanExpression? { From 21cfeeb86d3cce4582dc517f4ebca665927371ec Mon Sep 17 00:00:00 2001 From: DongGeon0908 Date: Sun, 24 Nov 2024 11:49:50 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=EC=B9=9C=EA=B5=AC=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20=EC=A7=84=ED=96=89=EC=8B=9C,=20=EA=B0=80=EC=9E=A5?= =?UTF-8?q?=20=EC=B5=9C=EA=B7=BC=EC=97=90=20=EB=B4=89=ED=88=AC=EB=A5=BC=20?= =?UTF-8?q?=EC=A3=BC=EA=B3=A0=20=EB=B0=9B=EC=9D=80=20=EC=B9=9C=EA=B5=AC=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20query=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infrastructure/EnvelopeQRepository.kt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/domain/src/main/kotlin/com/oksusu/susu/domain/envelope/infrastructure/EnvelopeQRepository.kt b/domain/src/main/kotlin/com/oksusu/susu/domain/envelope/infrastructure/EnvelopeQRepository.kt index a6c3f071..82c21183 100644 --- a/domain/src/main/kotlin/com/oksusu/susu/domain/envelope/infrastructure/EnvelopeQRepository.kt +++ b/domain/src/main/kotlin/com/oksusu/susu/domain/envelope/infrastructure/EnvelopeQRepository.kt @@ -12,6 +12,7 @@ import com.oksusu.susu.domain.friend.domain.QFriend import com.oksusu.susu.domain.friend.domain.QFriendRelationship import com.oksusu.susu.domain.user.domain.QUser import com.querydsl.core.types.dsl.CaseBuilder +import com.querydsl.jpa.JPAExpressions import com.querydsl.jpa.impl.JPAQuery import jakarta.persistence.EntityManager import org.springframework.beans.factory.annotation.Autowired @@ -468,13 +469,22 @@ class EnvelopeQRepositoryImpl : EnvelopeQRepository, QuerydslRepositorySupport(E } override fun findLatestFriendEnvelopes(friendIds: Set): List { + /** sub query 질의를 위해, 별칭 지정 */ + val qSubEnvelope = QEnvelope("subEnvelope") + + /** 전달 기준 점에 대한 정보를 찾기 위한 sub query */ + val subQuery = JPAExpressions + .select(qSubEnvelope.handedOverAt.max()) + .from(qSubEnvelope) + .where(qSubEnvelope.friendId.eq(qEnvelope.friendId)) + return JPAQuery(entityManager) .select(qEnvelope) .from(qEnvelope) - .where(qEnvelope.friendId.`in`(friendIds)) - .groupBy(qEnvelope.friendId) - .having(qEnvelope.handedOverAt.eq(qEnvelope.handedOverAt.max())) - .fetch() + .where( + qEnvelope.friendId.`in`(friendIds), + qEnvelope.handedOverAt.eq(subQuery) + ).fetch() } override fun getMaxAmountEnvelopeInfoByUid(uid: Long, type: EnvelopeType): EnvelopeAndFriendModel? {