Added service method tests + javadocs
This commit is contained in:
@@ -21,11 +21,15 @@ public interface GroupRepository extends JpaRepository<Groups, Long> {
|
||||
@Query("SELECT COUNT(*) AS assinged_times FROM Assignment WHERE isPastAssignment=false GROUP BY group HAVING group_id=?1")
|
||||
Optional<Number> getAssignedAmount(Long groupId);
|
||||
|
||||
/**
|
||||
* 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)")
|
||||
*
|
||||
* @param groupIds list of groups ids
|
||||
* @return list of objects arrays where first object is Groups instance and
|
||||
* second is Long that is taken places value
|
||||
*/
|
||||
@Query("SELECT group, COUNT(*) AS assinged_times FROM Assignment a WHERE a.isPastAssignment=false GROUP BY a.group HAVING group_id IN (:ids)")
|
||||
// @Query(nativeQuery = true, value = "SELECT group_id, COUNT(*) AS
|
||||
// assinged_times FROM assignment WHERE is_past_assignment=0 GROUP BY group_id
|
||||
// HAVING group_id IN (:ids)")
|
||||
|
||||
List<Object[]> getAssignedAmounts(@Param("ids") List<Long> groupIds);
|
||||
|
||||
}
|
Reference in New Issue
Block a user