Browse Source

dev en cours

rajah 1 năm trước cách đây
mục cha
commit
195136c384

+ 3 - 17
src/main/java/fr/triplea/demovote/persistence/dao/ParticipantRepository.java

@@ -6,6 +6,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.NativeQuery;
 import org.springframework.data.repository.query.Param;
 
+import fr.triplea.demovote.persistence.dto.ParticipantList;
 import fr.triplea.demovote.persistence.dto.ParticipantOptionList;
 import fr.triplea.demovote.persistence.dto.ParticipantTransfer;
 import fr.triplea.demovote.persistence.model.Participant;
@@ -48,39 +49,24 @@ public interface ParticipantRepository extends JpaRepository<Participant, Intege
       + "FROM vote.participants AS p "
       + "WHERE p.numero_participant = :id AND p.flag_actif IS TRUE ")
   ParticipantTransfer searchById(@Param("id") int id);
-  
+
   @NativeQuery("SELECT DISTINCT "
-      + "TO_CHAR(p.date_creation, 'DD/MM/YYYY HH24:MI:SS') as date_creation, "
-      + "TO_CHAR(p.date_modification, 'DD/MM/YYYY HH24:MI:SS') as date_modification, "
       + "p.numero_participant, "
       + "p.nom, "
       + "p.prenom, "
       + "p.pseudonyme, "
-      + "'' AS mot_de_passe, "
       + "p.groupe, "
-      + "p.delai_deconnexion, "
-      + "p.adresse, "
-      + "p.code_postal, "
-      + "p.ville, "
-      + "p.pays, "
-      + "p.numero_telephone, "
       + "p.email, "
       + "p.statut, "
-      + "p.flag_machine, "
-      + "p.commentaire, "
       + "p.flag_jour1, "
       + "p.flag_jour2, "
       + "p.flag_jour3, "
       + "p.flag_dodo_sur_place, "
-      + "p.flag_amigabus, "
-      + "p.mode_paiement, "
-      + "TO_CHAR(p.date_inscription, 'DD/MM/YYYY HH24:MI:SS') as date_inscription, "
-      + "CAST(p.somme_recue AS VARCHAR) AS somme_recue, "
       + "p.flag_arrive "
       + "FROM vote.participants AS p "
       + "WHERE p.flag_actif IS TRUE "
       + "ORDER BY p.nom ASC, p.prenom ASC, p.pseudonyme ASC ")
-  List<ParticipantTransfer> getList();
+  List<ParticipantList> getList();
 
   @NativeQuery("SELECT DISTINCT p.* FROM vote.participants AS p WHERE p.flag_actif IS TRUE ORDER BY p.nom ASC, p.prenom ASC, p.pseudonyme ASC ")
   List<Participant> findAll();

+ 19 - 0
src/main/java/fr/triplea/demovote/persistence/dto/ParticipantList.java

@@ -0,0 +1,19 @@
+package fr.triplea.demovote.persistence.dto;
+
+public record ParticipantList
+(
+  int numeroParticipant,
+  String nom,
+  String prenom,
+  String pseudonyme,
+  String groupe,
+  String email,
+  String statut,
+  boolean hereDay1,
+  boolean hereDay2,
+  boolean hereDay3,
+  boolean sleepingOnSite,
+  boolean arrived
+) 
+{
+}

+ 2 - 1
src/main/java/fr/triplea/demovote/web/controller/ParticipantController.java

@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import fr.triplea.demovote.persistence.dao.ParticipantRepository;
+import fr.triplea.demovote.persistence.dto.ParticipantList;
 import fr.triplea.demovote.persistence.dto.ParticipantOptionList;
 import fr.triplea.demovote.persistence.dto.ParticipantTransfer;
 import fr.triplea.demovote.persistence.model.Participant;
@@ -41,7 +42,7 @@ public class ParticipantController
 
   @GetMapping(value = "/list")
   //@PreAuthorize("hasRole('LISTE_PARTICIPANTS')")
-  public List<ParticipantTransfer> getList() 
+  public List<ParticipantList> getList() 
   { 
     return participantRepository.getList(); 
   }