Interface GroupRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Groups,​java.lang.Long>, org.springframework.data.jpa.repository.JpaRepository<Groups,​java.lang.Long>, org.springframework.data.repository.PagingAndSortingRepository<Groups,​java.lang.Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Groups>, org.springframework.data.repository.Repository<Groups,​java.lang.Long>

@Repository
public interface GroupRepository
extends org.springframework.data.jpa.repository.JpaRepository<Groups,​java.lang.Long>
GroupRepository.find: Return list of: SELECT * FROM Groups WHERE time = i AND room = j AND capacity = k . Where i, j, k, ?1, ?2, ?3 are equale to variables. GroupRepository.getByCourse: Return list of: SELECT * FROM Groups WHERE course_id = i . Where i, ?1 are equale to variables.
  • Method Summary

    Modifier and Type Method Description
    java.util.Optional<Groups> find​(int time, java.lang.String room, int capacity)  
    java.util.Optional<Groups> find​(java.lang.Integer zaj_cyk_id, java.lang.Integer gr_nr)  
    java.util.Optional<java.lang.Number> getAssignedAmount​(java.lang.Long groupId)  
    java.util.List<java.lang.Object[]> getAssignedAmounts​(java.util.List<java.lang.Long> groupIds)
    PLAIN SQL QUERY: SELECT group_id, COUNT(*) assinged_times FROM assignment WHERE is_past_assignment=0 GROUP BY group_id HAVING group_id IN (:ids)")
    java.util.List<Groups> getByCourse​(java.lang.Long id)  

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getOne, saveAll, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findOne
  • Method Details

    • find

      @Query("FROM Groups WHERE time = ?1 AND room = ?2 AND capacity = ?3") java.util.Optional<Groups> find​(@Param("time") int time, @Param("room") java.lang.String room, @Param("capacity") int capacity)
    • find

      @Query("FROM Groups WHERE zajCykId = ?1 AND grNr = ?2") java.util.Optional<Groups> find​(@Param("zajCykId") java.lang.Integer zaj_cyk_id, @Param("grNr") java.lang.Integer gr_nr)
    • getByCourse

      @Query("FROM Groups WHERE course_id = ?1") java.util.List<Groups> getByCourse​(@Param("id") java.lang.Long id)
    • getAssignedAmount

      @Query("SELECT COUNT(*) AS assinged_times FROM Assignment WHERE isPastAssignment=false GROUP BY group HAVING group_id=?1") java.util.Optional<java.lang.Number> getAssignedAmount​(java.lang.Long groupId)
    • getAssignedAmounts

      @Query("SELECT group, COUNT(*) AS assinged_times FROM Assignment a WHERE a.isPastAssignment=false GROUP BY a.group HAVING group_id IN (:ids)") java.util.List<java.lang.Object[]> getAssignedAmounts​(@Param("ids") java.util.List<java.lang.Long> groupIds)
      PLAIN SQL QUERY: SELECT group_id, COUNT(*) assinged_times FROM assignment WHERE is_past_assignment=0 GROUP BY group_id HAVING group_id IN (:ids)")
      Parameters:
      groupIds - list of groups ids
      Returns:
      list of objects arrays where first object is Groups instance and second is Long that is taken places value