diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java index 2583c2b4a..1dbba9bd3 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java @@ -404,8 +404,23 @@ public List getRecent() { @Override public RecruitmentExistsResponse existsByCompanyId(Long companyId) { - boolean winterInternExists = recruitmentJpaRepository.existsByCompanyIdAndWinterIntern(companyId, true); - boolean experientialExists = recruitmentJpaRepository.existsByCompanyIdAndWinterIntern(companyId, false); + boolean winterInternExists = queryFactory + .selectOne() + .from(recruitmentEntity) + .where( + recruitmentEntity.company.id.eq(companyId), + recruitmentEntity.winterIntern.isTrue(), + recruitmentEntity.status.eq(RecruitStatus.RECRUITING) + ).fetchFirst() != null; + + boolean experientialExists = queryFactory + .selectOne() + .from(recruitmentEntity) + .where( + recruitmentEntity.company.id.eq(companyId), + recruitmentEntity.winterIntern.isFalse(), + recruitmentEntity.status.eq(RecruitStatus.RECRUITING) + ).fetchFirst() != null; return new RecruitmentExistsResponse(winterInternExists, experientialExists); }