Interface CommonsRepository

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

    Modifier and Type
    Method
    Description
    getNumCows(Long commonsId)
     
    getNumUsers(Long commonsId)
     

    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.commonsId=:commonsId") Optional<Integer> getNumCows(Long commonsId)
    • getNumUsers

      @Query("SELECT COUNT(uc.userId) FROM user_commons uc WHERE uc.commonsId=:commonsId") Optional<Integer> getNumUsers(Long commonsId)