33 lines
1.3 KiB
Java
33 lines
1.3 KiB
Java
package com.agendaestudantil.repositorio;
|
|
|
|
import com.agendaestudantil.entidade.Tarefa;
|
|
import org.springframework.data.mongodb.repository.MongoRepository;
|
|
import org.springframework.data.mongodb.repository.Query;
|
|
|
|
import org.springframework.stereotype.Repository;
|
|
import java.time.LocalDate;
|
|
import java.util.List;
|
|
|
|
@Repository
|
|
public interface TarefaRepositorio extends MongoRepository<Tarefa, String> {
|
|
List<Tarefa> findByEstudanteId(String estudanteId);
|
|
|
|
List<Tarefa> findByEstudanteIdAndStatus(String estudanteId, Tarefa.StatusTarefa status);
|
|
|
|
List<Tarefa> findByDisciplinaId(String disciplinaId);
|
|
|
|
@Query("{'estudanteId': ?0, 'dataEntrega': ?1}")
|
|
List<Tarefa> findByEstudanteIdAndDataEntrega(String estudanteId, LocalDate data);
|
|
|
|
@Query("{'estudanteId': ?0, 'dataEntrega': {$gte: ?1, $lte: ?2}}")
|
|
List<Tarefa> findByEstudanteIdAndDataEntregaBetween(String estudanteId, LocalDate inicio, LocalDate fim);
|
|
|
|
@Query("{'estudanteId': ?0, 'status': {$ne: ?1}}")
|
|
List<Tarefa> findTarefasPendentesByEstudanteId(String estudanteId, Tarefa.StatusTarefa status);
|
|
|
|
@Query("{'status': {$ne: 'CONCLUIDA'}, 'dataEntrega': {$gte: ?0, $lte: ?1}}")
|
|
List<Tarefa> findTarefasNaoConcluidasComDataEntre(LocalDate inicio, LocalDate fim);
|
|
|
|
void deleteByEstudanteId(String estudanteId);
|
|
}
|