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 832d0cfc..a2bdf73a 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 @@ -342,7 +342,7 @@ class EnvelopeQRepositoryImpl : EnvelopeQRepository, QuerydslRepositorySupport(E ).from(qEnvelope) .join(qUser).on(qEnvelope.uid.eq(qUser.id)) .join(qFriendRelationship).on(qEnvelope.friendId.eq(qFriendRelationship.friendId)) - .join(qCategoryAssignment).on(qEnvelope.id.eq(qCategoryAssignment.targetId)) + .join(qCategoryAssignment).on(qEnvelope.id.eq(qCategoryAssignment.targetId).and(qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE))) .where( qEnvelope.amount.between(minAmount, maxAmount), qEnvelope.uid.notIn(uid), diff --git a/domain/src/main/kotlin/com/oksusu/susu/domain/envelope/infrastructure/LedgerQRepository.kt b/domain/src/main/kotlin/com/oksusu/susu/domain/envelope/infrastructure/LedgerQRepository.kt index ffb2fafb..1edfc3e2 100644 --- a/domain/src/main/kotlin/com/oksusu/susu/domain/envelope/infrastructure/LedgerQRepository.kt +++ b/domain/src/main/kotlin/com/oksusu/susu/domain/envelope/infrastructure/LedgerQRepository.kt @@ -137,7 +137,10 @@ class LedgerQRepositoryImpl : LedgerQRepository, QuerydslRepositorySupport(Ledge ) ) .from(qLedger) - .join(qCategoryAssignment).on(qLedger.id.eq(qCategoryAssignment.targetId)) + .join(qCategoryAssignment).on( + qLedger.id.eq(qCategoryAssignment.targetId) + .and(qCategoryAssignment.targetType.eq(CategoryAssignmentType.LEDGER)) + ) .where(qLedger.uid.eq(uid)) .groupBy(qCategoryAssignment.categoryId) .fetch()