Package com.example.demo.calorie
Interface CalorieLogRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<CalorieLog,,Long> org.springframework.data.jpa.repository.JpaRepository<CalorieLog,,Long> org.springframework.data.repository.ListCrudRepository<CalorieLog,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<CalorieLog,,Long> org.springframework.data.repository.PagingAndSortingRepository<CalorieLog,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<CalorieLog>,org.springframework.data.repository.Repository<CalorieLog,Long>
public interface CalorieLogRepository
extends org.springframework.data.jpa.repository.JpaRepository<CalorieLog,Long>
Repository interface for
CalorieLog entities.
This interface extends JpaRepository and defines custom finder methods
to query calorie log data, primarily focusing on retrieving entries related to a specific user.
-
Method Summary
Modifier and TypeMethodDescriptionfindByUser(AppUser user) Retrieves a list of allCalorieLogentries associated with the specifiedAppUser.findByUserId(Long userId) Retrieves a list of allCalorieLogentries associated with the specified user ID.findByUserIdAndLogDate(Long userId, LocalDate logDate) Retrieves a list of allCalorieLogentries for a specific user on a specific date.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByUser
Retrieves a list of allCalorieLogentries associated with the specifiedAppUser.- Parameters:
user- TheAppUserwhose logs are to be fetched.- Returns:
- A list of
CalorieLogentries for the user.
-
findByUserId
Retrieves a list of allCalorieLogentries associated with the specified user ID.- Parameters:
userId- The ID of the user whose logs are to be fetched.- Returns:
- A list of
CalorieLogentries for the given user ID.
-
findByUserIdAndLogDate
Retrieves a list of allCalorieLogentries for a specific user on a specific date.- Parameters:
userId- The ID of the user.logDate- TheLocalDatefor which to retrieve the logs.- Returns:
- A list of
CalorieLogentries matching the user ID and log date.
-