- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Commons,Long>
, org.springframework.data.repository.Repository<Commons,Long>
@Repository
public interface CommonsRepository
extends org.springframework.data.repository.CrudRepository<Commons,Long>
-
Method Summary
Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
-
Method Details
-
getNumCows
@Query("SELECT sum(uc.numOfCows) from user_commons uc where uc.commons.id = :commonsId")
Optional<Integer> getNumCows(Long commonsId)
-
getNumUsers
@Query("SELECT COUNT(*) FROM user_commons uc WHERE uc.commons.id = :commonsId")
Optional<Integer> getNumUsers(Long commonsId)