From 055a3463361e82292ed52860876c8c697c6e858e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AA=85=EC=A7=84?= <4mj.eo@dsm.hs.kr> Date: Thu, 7 Nov 2024 08:45:36 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20::=20(#838)=20=EB=AA=A8=EC=A7=91?= =?UTF-8?q?=EC=A4=91=EC=9D=B8=20=EC=83=81=ED=83=9C=EB=A7=8C=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RecruitmentPersistenceAdapter.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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); }