Skip to content

Commit

Permalink
Merge pull request #121 from abes-esr/ITEM-463-les-demandes-en-saisis…
Browse files Browse the repository at this point in the history
…-sans-ligne-de-fichier-n'apparaisse-pas-dans-le-tdb

ITEM-464 Ajout left join
  • Loading branch information
EryneKL authored Jan 20, 2025
2 parents 5999987 + b178891 commit d9a8b5d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ public interface IDemandeExempDao extends JpaRepository<DemandeExemp, Integer> {
@Query("select e from TypeExemp e where e.numTypeExemp in (select d.typeExemp.numTypeExemp from DemandeExemp d where d.numDemande = :numDemande)")
TypeExemp getTypeExemp(@Param("numDemande") Integer numDemande);

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeExemp d JOIN d.ligneFichierExemps l where d.iln = :iln and d.etatDemande.numEtat not in (9, 2, 10) GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeExemp d LEFT JOIN d.ligneFichierExemps l where d.iln = :iln and d.etatDemande.numEtat not in (9, 2, 10) GROUP BY d")
List<DemandeDto> getActiveDemandesExempForUserExceptedPreparedStatus(@Param("iln") String iln);

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeExemp d JOIN d.ligneFichierExemps l where d.iln = :iln and d.etatDemande.numEtat not in (9, 10) GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeExemp d LEFT JOIN d.ligneFichierExemps l where d.iln = :iln and d.etatDemande.numEtat not in (9, 10) GROUP BY d")
List<DemandeDto> getAllActiveDemandesExempForAdmin(@Param("iln") String iln);

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeExemp d JOIN d.ligneFichierExemps l where d.etatDemande.numEtat not in (9, 10) GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeExemp d LEFT JOIN d.ligneFichierExemps l where d.etatDemande.numEtat not in (9, 10) GROUP BY d")
List<DemandeDto> getAllActiveDemandesExempForAdminExtended();

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeExemp d JOIN d.ligneFichierExemps l where d.iln = :iln and d.etatDemande.numEtat = 9 GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeExemp d LEFT JOIN d.ligneFichierExemps l where d.iln = :iln and d.etatDemande.numEtat = 9 GROUP BY d")
List<DemandeDto> getAllArchivedDemandesExemp(@Param("iln") String iln);

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeExemp d JOIN d.ligneFichierExemps l where d.etatDemande.numEtat = 9 GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeExemp d LEFT JOIN d.ligneFichierExemps l where d.etatDemande.numEtat = 9 GROUP BY d")
List<DemandeDto> getAllArchivedDemandesExempExtended();

//Même si l'ide signale la requête elle est correcte, demandes en statut terminé avec une ancienneté de plus de 90 jours sur la dernière date de modification récupérées
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ public interface IDemandeModifDao extends JpaRepository<DemandeModif, Integer> {
* @return les demandes appartenant à l'iln de l'utilisateur (un iln comprenant plusieurs rcr)
* et qui sont ni dans l'état préparé, ni dans l'état archivé
*/
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) FROM DemandeModif d JOIN d.ligneFichierModifs l where d.iln = :iln and d.etatDemande.numEtat not in (9, 2, 10) GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) FROM DemandeModif d LEFT JOIN d.ligneFichierModifs l where d.iln = :iln and d.etatDemande.numEtat not in (9, 2, 10) GROUP BY d")
List<DemandeDto> getActiveDemandesModifForUserExceptedPreparedStatus(@Param("iln") String iln);

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeModif d JOIN d.ligneFichierModifs l where d.iln = :iln and d.etatDemande.numEtat not in (9, 10) GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeModif d LEFT JOIN d.ligneFichierModifs l where d.iln = :iln and d.etatDemande.numEtat not in (9, 10) GROUP BY d")
List<DemandeDto> getAllActiveDemandesModifForAdmin(@Param("iln") String iln);

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeModif d JOIN d.ligneFichierModifs l where d.etatDemande.numEtat not in (9, 2, 10) GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeModif d LEFT JOIN d.ligneFichierModifs l where d.etatDemande.numEtat not in (9, 2, 10) GROUP BY d")
List<DemandeDto> getAllActiveDemandesModifForAdminExtended();

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeModif d JOIN d.ligneFichierModifs l where d.iln = :iln and d.etatDemande.numEtat = 9 GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeModif d LEFT JOIN d.ligneFichierModifs l where d.iln = :iln and d.etatDemande.numEtat = 9 GROUP BY d")
List<DemandeDto> getAllArchivedDemandesModif(@Param("iln") String iln);

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeModif d JOIN d.ligneFichierModifs l where d.etatDemande.numEtat = 9 GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) from DemandeModif d LEFT JOIN d.ligneFichierModifs l where d.etatDemande.numEtat = 9 GROUP BY d")
List<DemandeDto> getAllArchivedDemandesModifExtended();

@Query("select d from DemandeModif d join d.ligneFichierModifs l where d.etatDemande.numEtat = 5 group by d having count(l) > :limite order by d.dateModification")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
@ItemConfiguration
public interface IDemandeSuppDao extends JpaRepository<DemandeSupp, Integer> {

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) FROM DemandeSupp d JOIN d.ligneFichierSupps l WHERE d.etatDemande.numEtat NOT IN (9, 10) GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) FROM DemandeSupp d LEFT JOIN d.ligneFichierSupps l WHERE d.etatDemande.numEtat NOT IN (9, 10) GROUP BY d")
List<DemandeDto> getAllActiveDemandesSuppForAdminExtended();

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) FROM DemandeSupp d JOIN d.ligneFichierSupps l where d.iln = :iln and d.etatDemande.numEtat not in (9, 10) GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) FROM DemandeSupp d LEFT JOIN d.ligneFichierSupps l where d.iln = :iln and d.etatDemande.numEtat not in (9, 10) GROUP BY d")
List<DemandeDto> getAllActiveDemandesSuppForAdmin(@Param("iln") String iln);

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) FROM DemandeSupp d JOIN d.ligneFichierSupps l where d.iln = :iln and d.etatDemande.numEtat = 9 GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) FROM DemandeSupp d LEFT JOIN d.ligneFichierSupps l where d.iln = :iln and d.etatDemande.numEtat = 9 GROUP BY d")
List<DemandeDto> getAllArchivedDemandesSupp(@Param("iln") String iln);

@Query("select new fr.abes.item.core.dto.DemandeDto(d, count(l)) from DemandeSupp d JOIN d.ligneFichierSupps l where d.iln = :iln and d.etatDemande.numEtat not in (9, 2, 10) GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, count(l)) from DemandeSupp d LEFT JOIN d.ligneFichierSupps l where d.iln = :iln and d.etatDemande.numEtat not in (9, 2, 10) GROUP BY d")
List<DemandeDto> getActiveDemandesSuppForUserExceptedPreparedStatus(@Param("iln") String iln);

@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) FROM DemandeSupp d JOIN d.ligneFichierSupps l where d.etatDemande.numEtat = 9 GROUP BY d")
@Query("select new fr.abes.item.core.dto.DemandeDto(d, COUNT(l)) FROM DemandeSupp d LEFT JOIN d.ligneFichierSupps l where d.etatDemande.numEtat = 9 GROUP BY d")
List<DemandeDto> getAllArchivedDemandesSuppExtended();

@Query("select d from DemandeSupp d join d.ligneFichierSupps l where d.etatDemande.numEtat = 5 group by d having count(l) > :limite order by d.dateModification")
Expand Down

0 comments on commit d9a8b5d

Please # to comment.