Skip to content

Commit

Permalink
update find all maintenance query
Browse files Browse the repository at this point in the history
  • Loading branch information
gioelemella committed Jul 23, 2024
1 parent 8e86515 commit fb5bccf
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@
public interface StationMaintenanceRepository extends JpaRepository<StationMaintenance, Long> {

@Query(value =
"SELECT m " +
"FROM StationMaintenance m JOIN FETCH m.station s JOIN FETCH s.intermediarioPa ipa " +
"WHERE m.fkStation = s.objId " +
"AND s.fkIntermediarioPa = ipa.objId " +
"AND ipa.idIntermediarioPa = :brokerCode " +
"AND (:stationCode IS NULL OR UPPER(s.idStazione) LIKE CONCAT('%', UPPER(:stationCode), '%')) " +
"AND (:startDateTimeBefore IS NULL OR m.startDateTime < :startDateTimeBefore) " +
"AND (:startDateTimeAfter IS NULL OR m.startDateTime > :startDateTimeAfter) " +
"AND (:endDateTimeBefore IS NULL OR m.endDateTime < :endDateTimeBefore) " +
"AND (:endDateTimeAfter IS NULL OR m.endDateTime > :endDateTimeAfter)",
countQuery =
"SELECT m " +
"FROM StationMaintenance m JOIN Stazioni s ON m.fkStation = s.objId JOIN IntermediariPa ipa ON s.fkIntermediarioPa = ipa.objId " +
"WHERE ipa.idIntermediarioPa = :brokerCode " +
Expand Down

0 comments on commit fb5bccf

Please sign in to comment.