diff --git a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/ApplicationPersistenceAdapter.kt b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/ApplicationPersistenceAdapter.kt index 4ef61c34..f66c7a9c 100644 --- a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/ApplicationPersistenceAdapter.kt +++ b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/ApplicationPersistenceAdapter.kt @@ -35,7 +35,10 @@ class ApplicationPersistenceAdapter( .selectFrom(applicationEntity) .innerJoin(applicationEntity.statusEntity, statusEntity) .on(applicationEntity.statusEntity.id.eq(statusId)) - .where(statusEntity.studentId.eq(studentId)) + .where( + statusEntity.studentId.eq(studentId), + applicationEntity.isReturn.eq(false), + ) .fetchFirst() ?.let(applicationMapper::entityToDomain) } diff --git a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/StatusPersistenceAdapter.kt b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/StatusPersistenceAdapter.kt index 084dd957..f557a239 100644 --- a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/StatusPersistenceAdapter.kt +++ b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/StatusPersistenceAdapter.kt @@ -99,10 +99,13 @@ class StatusPersistenceAdapter( override fun queryPicnicStudentByStudentIdAndToday(studentId: UUID): Status? = jpaQueryFactory .selectFrom(statusEntity) + .join(applicationEntity) + .on(statusEntity.id.eq(applicationEntity.statusEntity.id)) .where( statusEntity.studentId.eq(studentId), statusEntity.type.eq(StatusType.PICNIC), statusEntity.date.eq(LocalDate.now()), + applicationEntity.isReturn.eq(false), ) .fetchFirst() ?.let(statusMapper::entityToDomain)