diff --git a/src/main/java/com/ssafy/ssafsound/domain/recruit/repository/RecruitDynamicQueryRepositoryImpl.java b/src/main/java/com/ssafy/ssafsound/domain/recruit/repository/RecruitDynamicQueryRepositoryImpl.java index 988ff4c7..998d5edc 100644 --- a/src/main/java/com/ssafy/ssafsound/domain/recruit/repository/RecruitDynamicQueryRepositoryImpl.java +++ b/src/main/java/com/ssafy/ssafsound/domain/recruit/repository/RecruitDynamicQueryRepositoryImpl.java @@ -73,7 +73,7 @@ public Page findRecruitPageByGetRecruitsReqDto(GetRecruitsOffsetReqDto .where( recruitCategoryEq(dto.getCategory()), recruitTitleEq(dto.getKeyword()), - recruit.finishedRecruit.eq(dto.isFinished()), + notFinishedRecruit(dto.isFinished()), recruitTypeContains(dto.getCategory(), dto.getRecruitTypes()), recruitSkillContains(dto.getSkills()) ); @@ -81,13 +81,17 @@ public Page findRecruitPageByGetRecruitsReqDto(GetRecruitsOffsetReqDto return PageableExecutionUtils.getPage(recruits, pageable, countQuery::fetchOne); } + private static BooleanExpression notFinishedRecruit(boolean isFinished) { + return isFinished ? null : recruit.finishedRecruit.eq(false); + } + private JPAQuery findRecruitByGetRecruitsReqDto(RecruitPaging dto) { JPAQuery recruitDynamicQuery = jpaQueryFactory.selectFrom(recruit); recruitDynamicQuery .where( recruitCategoryEq(dto.getCategory()), recruitTitleEq(dto.getKeyword()), - recruit.finishedRecruit.eq(dto.isFinished()), + notFinishedRecruit(dto.isFinished()), recruitTypeContains(dto.getCategory(), dto.getRecruitTypes()), recruitSkillContains(dto.getSkills()) );