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 Type
    Method
    Description
    Check availability for working hours.
    Check day and hour availability.

    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, findAll, findAll, findAllById, flush, getById, getOne, getReferenceById, saveAll, saveAllAndFlush, saveAndFlush

    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

    • 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.