main
Last change
on this file since ac151d1 was ac151d1, checked in by David <darsov2@…>, 11 days ago |
initial
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | package mk.ukim.finki.eglas.repository;
|
---|
2 |
|
---|
3 | import mk.ukim.finki.eglas.model.Citizen;
|
---|
4 | import mk.ukim.finki.eglas.model.PollingStation;
|
---|
5 | import mk.ukim.finki.eglas.model.dto.CitizenVote;
|
---|
6 | import org.springframework.data.jpa.repository.JpaRepository;
|
---|
7 | import org.springframework.data.jpa.repository.Query;
|
---|
8 | import org.springframework.data.repository.query.Param;
|
---|
9 |
|
---|
10 | import java.util.List;
|
---|
11 | import java.util.Optional;
|
---|
12 |
|
---|
13 | public interface CitizenRepository extends JpaRepository<Citizen, Long> {
|
---|
14 | Optional<Citizen> findByIdNum(String idNum);
|
---|
15 | @Query(value = "select count(distinct g_embg) from gragjani where age(now(), g_datum_ragjanje) > interval '18 years'", nativeQuery = true)
|
---|
16 | Integer availableVoters();
|
---|
17 | List<Citizen> findAllByDocumentIsNotNullAndAddress_PollingStation_Id(Long pollingStationId);
|
---|
18 | @Query("select new mk.ukim.finki.eglas.model.dto.CitizenVote(c, t.voteTimestamp) from Citizen c left join Turnout t on t.citizen.id = c.id where c.address.pollingStation.id = :pollingStationId")
|
---|
19 | List<CitizenVote> findAllByAddress_PollingStation(@Param("pollingStationId") Long pollingStationId);
|
---|
20 |
|
---|
21 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.