From 2d36caf8da9d5132a3fcbc65dbcdf0d35807719d Mon Sep 17 00:00:00 2001 From: pierre-maraval Date: Tue, 12 Nov 2024 15:30:33 +0100 Subject: [PATCH] refactor : Retouche sauts de lignes, suppression @column --- core/src/main/java/fr/abes/item/core/dto/DemandeDto.java | 2 -- .../fr/abes/item/core/repository/item/IDemandeSuppDao.java | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/fr/abes/item/core/dto/DemandeDto.java b/core/src/main/java/fr/abes/item/core/dto/DemandeDto.java index 1459c12..dc65d62 100644 --- a/core/src/main/java/fr/abes/item/core/dto/DemandeDto.java +++ b/core/src/main/java/fr/abes/item/core/dto/DemandeDto.java @@ -2,7 +2,6 @@ import fr.abes.item.core.entities.baseXml.LibProfile; import fr.abes.item.core.entities.item.Demande; -import jakarta.persistence.Column; import lombok.Getter; import lombok.Setter; @@ -14,7 +13,6 @@ public class DemandeDto { private Demande demande; - @Column(name = "NB_LIGNEFICHIER") private Integer nbLignes; public DemandeDto(Demande demande, Integer nbLignes) { diff --git a/core/src/main/java/fr/abes/item/core/repository/item/IDemandeSuppDao.java b/core/src/main/java/fr/abes/item/core/repository/item/IDemandeSuppDao.java index a3c8335..0b32ee0 100644 --- a/core/src/main/java/fr/abes/item/core/repository/item/IDemandeSuppDao.java +++ b/core/src/main/java/fr/abes/item/core/repository/item/IDemandeSuppDao.java @@ -9,7 +9,6 @@ import org.springframework.stereotype.Repository; import java.util.List; -import java.util.Optional; @Repository @ItemConfiguration @@ -17,14 +16,19 @@ public interface IDemandeSuppDao extends JpaRepository { @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") List 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") List 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") List getAllArchivedDemandesSupp(@Param("iln") String iln); + @Query("select d from DemandeSupp d where d.iln = :iln and d.etatDemande.numEtat not in (9, 2, 10)") List 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") List getAllArchivedDemandesSuppExtended(); + List findDemandeSuppsByEtatDemande_IdOrderByDateModificationAsc(Integer id); @Query("select d from DemandeSupp d where d.etatDemande.numEtat = 7 and (day(current_date) - day(d.dateModification)) > 90 order by d.dateModification asc")