From 0df3390fd08e2677e5344455e1ecfa26eea4c885 Mon Sep 17 00:00:00 2001 From: Alix JEUDI--LEMOINE Date: Fri, 1 Mar 2024 13:03:41 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20recherche=20avec=20crit=C3=A8re=20au=20?= =?UTF-8?q?QuestionService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sae/services/QuestionService.java | 15 ++++++++++----- .../sae/services/interfaces/IQuestionService.java | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/services/QuestionService.java b/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/services/QuestionService.java index db31cec..6d07363 100644 --- a/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/services/QuestionService.java +++ b/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/services/QuestionService.java @@ -2,22 +2,27 @@ package fr.iut.sciencequest.sae.services; import fr.iut.sciencequest.sae.entities.Question; import fr.iut.sciencequest.sae.repositories.QuestionRepository; +import fr.iut.sciencequest.sae.repositories.ReponseRepository; import fr.iut.sciencequest.sae.services.interfaces.IQuestionService; +import lombok.AllArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; +@AllArgsConstructor @Service public class QuestionService implements IQuestionService { private final QuestionRepository questionRepository; - - public QuestionService(QuestionRepository questionRepository) { - this.questionRepository = questionRepository; - } + private final ReponseRepository reponseRepository; @Override public Page findAll(Pageable p) { - //Pageable paging = PageRequest.of(page, PAGE_SIZE); return questionRepository.findAll(p); } + + @Override + public Page findWithCriteria(Pageable page, Integer scientifiqueId) { + return questionRepository.findAllQuestionsByScientifiqueId(page, scientifiqueId); + } + } diff --git a/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/services/interfaces/IQuestionService.java b/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/services/interfaces/IQuestionService.java index 310b813..25c12f0 100644 --- a/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/services/interfaces/IQuestionService.java +++ b/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/services/interfaces/IQuestionService.java @@ -6,4 +6,5 @@ import org.springframework.data.domain.Pageable; public interface IQuestionService { Page findAll(Pageable page); + Page findWithCriteria(Pageable page, Integer scientifiqueId); }