Skip to content

Commit

Permalink
fix: 리크루트 마감 여부 false인 경우만 적용되도록 동적 쿼리 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
khs960616 authored Oct 25, 2023
1 parent 626df69 commit 75f1437
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,25 @@ public Page<Recruit> 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())
);

return PageableExecutionUtils.getPage(recruits, pageable, countQuery::fetchOne);
}

private static BooleanExpression notFinishedRecruit(boolean isFinished) {
return isFinished ? null : recruit.finishedRecruit.eq(false);
}

private JPAQuery<Recruit> findRecruitByGetRecruitsReqDto(RecruitPaging<? extends Number> dto) {
JPAQuery<Recruit> 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())
);
Expand Down

0 comments on commit 75f1437

Please sign in to comment.