main
Line | |
---|
1 | package mk.profesori.springapp.Repository;
|
---|
2 |
|
---|
3 | import mk.profesori.springapp.Model.Faculty;
|
---|
4 | import mk.profesori.springapp.Model.StudyProgramme;
|
---|
5 | import org.springframework.data.jpa.repository.Query;
|
---|
6 | import org.springframework.data.repository.CrudRepository;
|
---|
7 | import org.springframework.data.repository.query.Param;
|
---|
8 | import org.springframework.stereotype.Repository;
|
---|
9 |
|
---|
10 | import java.util.List;
|
---|
11 |
|
---|
12 |
|
---|
13 | @Repository
|
---|
14 | public interface StudyProgrammeRepository extends CrudRepository<StudyProgramme, Long>{
|
---|
15 | List<StudyProgramme> findAll();
|
---|
16 | StudyProgramme findByStudyProgrammeId(Long id);
|
---|
17 | List<StudyProgramme> findByFaculty(Faculty faculty);
|
---|
18 | @Query(value = "select subject.id, count(p.*)\n" +
|
---|
19 | "from subject left join post p on subject.id = p.subject_id\n" +
|
---|
20 | "where subject.study_programme_id = :studyProgrammeId\n" +
|
---|
21 | "group by subject.id\n" +
|
---|
22 | "order by subject.id;", nativeQuery = true)
|
---|
23 | List<String> getThreadCountForEachSubjectInStudyProgramme(@Param("studyProgrammeId") Long id);
|
---|
24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.