Skip to content

Commit

Permalink
[FO-932] (모집) 마감임박순 정렬 에러 수정 (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkyoungdeok authored Feb 21, 2024
1 parent 75ae4f2 commit 38886c2
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,23 +268,23 @@ class JobOpeningRepositoryImpl(
}

private fun SpringDataReactiveCriteriaQueryDsl<JobOpening?>.orderSpec(sort: Sort): List<OrderSpec> {
val deadlineIsNull =
val recruitmentEndDateIsNull =
case(
`when`(column(JobOpening::recruitmentEndDate).isNull()).then(
literal(1)
),
`else` = literal(0)
).asc()

val deadlineAfterToday =
val recruitmentEndDateAfterToday =
case(
`when`(column(JobOpening::recruitmentEndDate).greaterThan(LocalDate.now())).then(
literal(1)
),
`else` = literal(0)
).desc()

val deadlineDesc = column(JobOpening::recruitmentEndDate).asc()
val recruitmentEndDateDesc = column(JobOpening::recruitmentEndDate).asc()

val res =
sort.map {
Expand All @@ -303,8 +303,8 @@ class JobOpeningRepositoryImpl(
}
}.toList()

return if (sort.map { it.property }.contains("deadline")) {
listOf(deadlineIsNull, deadlineAfterToday, deadlineDesc)
return if (sort.map { it.property }.contains("recruitmentEndDate")) {
listOf(recruitmentEndDateIsNull, recruitmentEndDateAfterToday, recruitmentEndDateDesc)
} else {
res
}
Expand Down

0 comments on commit 38886c2

Please sign in to comment.