Skip to content

Commit

Permalink
MAN-28 - order licence conditions to match delius
Browse files Browse the repository at this point in the history
  • Loading branch information
achimber-moj committed Oct 21, 2024
1 parent 4ac4ff5 commit 4a09da0
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import jakarta.persistence.*
import org.hibernate.annotations.Immutable
import org.hibernate.annotations.SQLRestriction
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
import uk.gov.justice.digital.hmpps.integrations.delius.referencedata.entity.ReferenceData
import java.time.LocalDate

Expand Down Expand Up @@ -45,7 +46,17 @@ class LicenceCondition(

interface LicenceConditionRepository : JpaRepository<LicenceCondition, Long> {

@Query(
"""
SELECT lc FROM LicenceCondition lc
JOIN FETCH lc.mainCategory mc
LEFT JOIN FETCH lc.subCategory
WHERE lc.disposalId = :disposalId
ORDER BY mc.description ASC
"""
)
fun findAllByDisposalId(disposalId: Long): List<LicenceCondition>

}

fun LicenceConditionRepository.getByLicenceConditionId(id: Long) = findById(id)
Expand Down

0 comments on commit 4a09da0

Please sign in to comment.