Skip to content

Commit

Permalink
[PPANTT-106] feat: updated Stazioni with new filter in stazioni repos…
Browse files Browse the repository at this point in the history
…itory
  • Loading branch information
alessio-cialini committed Sep 5, 2024
1 parent a35b380 commit 429c66b
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,37 @@ public interface StazioniRepository extends JpaRepository<Stazioni, Long>, JpaSp
"select distinct s from Stazioni s, PaStazionePa r where (:fkIntermediario is null or"
+ " s.fkIntermediarioPa = :fkIntermediario) and (r.fkPa = :fkPa and r.fkStazione = s)"
+ " and (:idStazione is null or upper(s.idStazione) like concat('%',"
+ " upper(:idStazione), '%')) ")
+ " upper(:idStazione), '%')) "
+ " AND (cast(cast(:createDateBefore as text) as timestamp) IS NULL OR s.dataCreazione < cast(cast(:createDateBefore as text) as timestamp)) "
+ " AND (cast(cast(:createDateAfter as text) as timestamp) IS NULL OR s.dataCreazione > cast(cast(:createDateAfter as text) as timestamp)) "
+ " AND ((:connectionType IS NULL OR :connectionType = 'NONE') "
+ " OR (:connectionType = 'SYNC' AND servizio LIKE '%gpd%')"
+ " OR (:connectionType = 'ASYNC' AND (servizio IS NULL or servizio NOT LIKE '%gpd%')))")
Page<Stazioni> findAllByFilters(
@Param("fkIntermediario") Long fkIntermediario,
@Param("fkPa") Long fkPa,
@Param("idStazione") String idStazione,
@Param("createDateBefore") OffsetDateTime createDateBefore,
@Param("createDateAfter") OffsetDateTime createDateAfter,
@Param("connectionType") String connectionType,
Pageable pageable);

@Query(
value =
"select distinct s from Stazioni s where (:fkIntermediario is null or s.fkIntermediarioPa"
+ " = :fkIntermediario) and (:idStazione is null or upper(s.idStazione) like"
+ " concat('%', upper(:idStazione), '%')) ")
+ " concat('%', upper(:idStazione), '%')) "
+ " AND (cast(cast(:createDateBefore as text) as timestamp) IS NULL OR s.dataCreazione < cast(cast(:createDateBefore as text) as timestamp)) "
+ " AND (cast(cast(:createDateAfter as text) as timestamp) IS NULL OR s.dataCreazione > cast(cast(:createDateAfter as text) as timestamp)) "
+ " AND ((:connectionType IS NULL OR :connectionType = 'NONE') "
+ " OR (:connectionType = 'SYNC' AND servizio LIKE '%gpd%')"
+ " OR (:connectionType = 'ASYNC' AND (servizio IS NULL or servizio NOT LIKE '%gpd%')))")
Page<Stazioni> findAllByFilters(
@Param("fkIntermediario") Long fkIntermediario,
@Param("idStazione") String idStazione,
@Param("createDateBefore") OffsetDateTime createDateBefore,
@Param("createDateAfter") OffsetDateTime createDateAfter,
@Param("connectionType") String connectionType,
Pageable pageable);

@Query(
Expand Down

0 comments on commit 429c66b

Please sign in to comment.