Ignore:
Timestamp:
01/20/23 22:57:18 (17 months ago)
Author:
viktor <viktor@…>
Branches:
main
Children:
8dffe02
Parents:
4abf55a
Message:

prefinal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • springapp/src/main/java/mk/profesori/springapp/Repository/FacultyRepository.java

    r4abf55a r9bf1f8d  
    11package mk.profesori.springapp.Repository;
     2
     3import mk.profesori.springapp.Model.Faculty;
     4import mk.profesori.springapp.Model.University;
     5import org.springframework.data.jpa.repository.Query;
     6import org.springframework.data.repository.CrudRepository;
     7import org.springframework.data.repository.query.Param;
     8import org.springframework.stereotype.Repository;
    29
    310import java.util.List;
    411
    5 import org.springframework.data.repository.CrudRepository;
    6 import org.springframework.stereotype.Repository;
    7 
    8 import mk.profesori.springapp.Model.Faculty;
    9 import mk.profesori.springapp.Model.University;
    10 
    1112@Repository
    1213public interface FacultyRepository extends CrudRepository<Faculty, Long>{
    13 
    1414    List<Faculty> findAll();
    1515    Faculty findByFacultyId(Long id);
    1616    List<Faculty> findByUniversity(University university);
     17    @Query(value = "select professor.id, count(p.*)\n" +
     18            "from professor left join post p on professor.id = p.professor_id\n" +
     19            "where professor.faculty_id = :facultyId\n" +
     20            "group by professor.id\n" +
     21            "order by professor.id;", nativeQuery = true)
     22    List<String> getOpinionCountForEachProfessorInFaculty(@Param("facultyId") Long id);
    1723}
Note: See TracChangeset for help on using the changeset viewer.