Skip to content
New issue

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

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

Already on GitHub? # to your account

ITEM-464 Ajout left join #121

Merged
Show file tree
Hide file tree
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 @@ -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
Loading