Skip to content

Commit

Permalink
[IDLE-000] jobPosting 전체 조회 쿼리 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
wonjunYou committed Sep 21, 2024
1 parent bf8cf4e commit f4f465b
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,21 @@ class JobPostingSpatialQueryRepository(
return emptyList()
}

val isFavorite = jobPostingFavorite.id.isNotNull
.and(jobPostingFavorite.entityStatus.eq(EntityStatus.ACTIVE))

return jpaQueryFactory
.selectDistinct(jobPosting, jobPostingWeekday, jobPostingFavorite, applys)
.selectDistinct(
jobPosting,
jobPostingWeekday,
applys.createdAt,
Expressions.booleanTemplate(
"case when {0} is not null and {1} = {2} then true else false end",
jobPostingFavorite.id,
jobPostingFavorite.entityStatus,
EntityStatus.ACTIVE
)
)
.from(jobPosting)
.leftJoin(jobPostingWeekday).fetchJoin()
.on(jobPosting.id.eq(jobPostingWeekday.jobPostingId))
Expand All @@ -61,8 +74,12 @@ class JobPostingSpatialQueryRepository(
jobPosting,
list(jobPostingWeekday),
applys.createdAt ?: null,
jobPostingFavorite.id.isNotNull
.and(jobPostingFavorite.entityStatus.eq(EntityStatus.ACTIVE))
Expressions.booleanTemplate(
"case when {0} is not null and {1} = {2} then true else false end",
jobPostingFavorite.id,
jobPostingFavorite.entityStatus,
EntityStatus.ACTIVE
)
)
)
)
Expand Down

0 comments on commit f4f465b

Please sign in to comment.