Interface StatRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Statistics,Long>, org.springframework.data.jpa.repository.JpaRepository<Statistics,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Statistics>, org.springframework.data.repository.ListCrudRepository<Statistics,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Statistics,Long>, org.springframework.data.repository.PagingAndSortingRepository<Statistics,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Statistics>, org.springframework.data.repository.Repository<Statistics,Long>

public interface StatRepository extends org.springframework.data.jpa.repository.JpaRepository<Statistics,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Statistics>
  • Method Summary

    Modifier and Type
    Method
    Description
    Find all statistics by fridge ID.
    findAllByFridgeAndStatType(Long fridgeId, Long statTypeId)
     
    Find all statistics by user ID.
    findAllByUserAndStatType(Long userId, Long statTypeId)
     

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

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

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

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

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

    count, delete, exists, findAll, findAll, findAll, findBy, findOne

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

    findAll, findAllById, saveAll

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

    findAll

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

    findAll

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

    count, exists, findAll, findBy, findOne
  • Method Details

    • findAllByFridge

      @Query("SELECT s FROM Statistics s WHERE s.fridge.fridgeId = :fridgeId") List<Statistics> findAllByFridge(@Param("fridgeId") Long fridgeId)
      Find all statistics by fridge ID.
      Parameters:
      fridgeId - The fridge ID.
      Returns:
      A list of statistics for the specified fridge.
    • findAllByFridgeAndStatType

      @Query("SELECT s FROM Statistics s WHERE s.statType.statTypeId = :statTypeId AND s.fridge.fridgeId = :fridgeId ORDER BY s.timestamp ASC") List<Statistics> findAllByFridgeAndStatType(@Param("fridgeId") Long fridgeId, @Param("statTypeId") Long statTypeId)
    • findAllByUserAndStatType

      @Query("SELECT s FROM Statistics s WHERE s.statType.statTypeId = :statTypeId AND s.user.userId = :userId ORDER BY s.timestamp ASC") List<Statistics> findAllByUserAndStatType(@Param("userId") Long userId, @Param("statTypeId") Long statTypeId)
    • findAllByUser

      List<Statistics> findAllByUser(User user)
      Find all statistics by user ID.
      Parameters:
      user - The user entity.
      Returns:
      A list of statistics for the specified user.