Interface WorkHourRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<WorkHour,,Long> org.springframework.data.jpa.repository.JpaRepository<WorkHour,,Long> org.springframework.data.repository.PagingAndSortingRepository<WorkHour,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<WorkHour>,org.springframework.data.repository.Repository<WorkHour,Long>
@Repository
public interface WorkHourRepository
extends org.springframework.data.jpa.repository.JpaRepository<WorkHour,Long>
WorkHour repository.
-
Method Summary
Modifier and TypeMethodDescriptionCheck availability for working hours.findWorkHoursByHourAndAppointment(String day, int hour) Check day and hour availability.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, findAll, findAll, findAllById, flush, getById, getOne, getReferenceById, saveAll, saveAllAndFlush, saveAndFlushMethods 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
-
findWorkHoursByAppointments
@Query(value="SELECT wh.* FROM work_hour wh LEFT JOIN appointment a ON wh.id = a.hour_id AND a.day = to_date(:day,\'DD/MM/YYYY\') WHERE a.hour_id is null AND wh.active = true", nativeQuery=true) List<WorkHour> findWorkHoursByAppointments(@Param("day") String day) Check availability for working hours.- Parameters:
day- in format dd/MM/yyyy.- Returns:
- list of working hours.
-
findWorkHoursByHourAndAppointment
@Query(value="SELECT wh.* FROM work_hour wh LEFT JOIN appointment a ON wh.id = a.hour_id AND a.day = to_date(:day,\'DD/MM/YYYY\') WHERE a.hour_id = :hour AND wh.active = true", nativeQuery=true) Optional<WorkHour> findWorkHoursByHourAndAppointment(@Param("day") String day, @Param("hour") int hour) Check day and hour availability.- Parameters:
day- in format dd/MM/yyyy.hour- hour identifier.- Returns:
- list of working hours.
-