Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: StationMaintenanceRepository paged find casting on null date time #50

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ public interface StationMaintenanceRepository extends JpaRepository<StationMaint
"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)",
"AND (cast(cast(:startDateTimeBefore as text) as timestamp) IS NULL OR m.startDateTime < cast(cast(:startDateTimeBefore as text) as timestamp)) " +
"AND (cast(cast(:startDateTimeAfter as text) as timestamp) IS NULL OR m.startDateTime > cast(cast(:startDateTimeAfter as text) as timestamp)) " +
"AND (cast(cast(:endDateTimeBefore as text) as timestamp) IS NULL OR m.endDateTime < cast(cast(:endDateTimeBefore as text) as timestamp)) " +
"AND (cast(cast(:endDateTimeAfter as text) as timestamp) IS NULL OR m.endDateTime > cast(cast(:endDateTimeAfter as text) as timestamp))",
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 " +
"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)")
"AND (cast(cast(:startDateTimeBefore as text) as timestamp) IS NULL OR m.startDateTime < cast(cast(:startDateTimeBefore as text) as timestamp)) " +
"AND (cast(cast(:startDateTimeAfter as text) as timestamp) IS NULL OR m.startDateTime > cast(cast(:startDateTimeAfter as text) as timestamp)) " +
"AND (cast(cast(:endDateTimeBefore as text) as timestamp) IS NULL OR m.endDateTime < cast(cast(:endDateTimeBefore as text) as timestamp)) " +
"AND (cast(cast(:endDateTimeAfter as text) as timestamp) IS NULL OR m.endDateTime > cast(cast(:endDateTimeAfter as text) as timestamp))")
Page<StationMaintenance> findAllByFilters(
@Param("brokerCode") String brokerCode,
@Param("stationCode") String stationCode,
Expand Down
Loading