Interface ShiftRepository

  • All Superinterfaces:
    org.springframework.data.repository.CrudRepository<Shift,​Long>, org.springframework.data.jpa.repository.JpaRepository<Shift,​Long>, org.springframework.data.repository.PagingAndSortingRepository<Shift,​Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Shift>, org.springframework.data.repository.Repository<Shift,​Long>

    @Repository
    public interface ShiftRepository
    extends org.springframework.data.jpa.repository.JpaRepository<Shift,​Long>
    • Method Detail

      • findAllByTenantId

        @Query("select distinct sa from Shift sa left join fetch sa.spot s left join fetch sa.rotationEmployee re left join fetch sa.originalEmployee oe left join fetch sa.employee e where sa.tenantId = :tenantId order by sa.startDateTime, s.name, e.name")
        List<Shift> findAllByTenantId​(@Param("tenantId")
                                      Integer tenantId)
      • findAllByTenantIdBetweenDates

        @Query("select distinct sa from Shift sa left join fetch sa.spot s left join fetch sa.rotationEmployee re left join fetch sa.originalEmployee oe left join fetch sa.employee e where sa.tenantId = :tenantId and sa.endDateTime >= :startDateTime and sa.startDateTime < :endDateTime order by sa.startDateTime, s.name, e.name")
        List<Shift> findAllByTenantIdBetweenDates​(@Param("tenantId")
                                                  Integer tenantId,
                                                  @Param("startDateTime")
                                                  OffsetDateTime startDateTime,
                                                  @Param("endDateTime")
                                                  OffsetDateTime endDateTime)
      • deleteForTenant

        @Modifying(flushAutomatically=true,
                   clearAutomatically=true)
        @Query("delete from Shift s where s.tenantId = :tenantId")
        void deleteForTenant​(@Param("tenantId")
                             Integer tenantId)
      • filterWithSpots

        @Query("select distinct sa from Shift sa left join fetch sa.spot s left join fetch sa.rotationEmployee re left join fetch sa.originalEmployee oe left join fetch sa.employee e where sa.tenantId = :tenantId and sa.spot IN :spotSet and sa.endDateTime >= :startDateTime and sa.startDateTime < :endDateTime order by sa.startDateTime, s.name, e.name")
        List<Shift> filterWithSpots​(@Param("tenantId")
                                    Integer tenantId,
                                    @Param("spotSet")
                                    Set<Spot> spotSet,
                                    @Param("startDateTime")
                                    OffsetDateTime startDateTime,
                                    @Param("endDateTime")
                                    OffsetDateTime endDateTime)
      • filterWithEmployees

        @Query("select distinct sa from Shift sa left join fetch sa.spot s left join fetch sa.rotationEmployee re left join fetch sa.originalEmployee oe left join fetch sa.employee e where sa.tenantId = :tenantId and sa.employee IN :employeeSet and sa.endDateTime >= :startDateTime and sa.startDateTime < :endDateTime order by sa.startDateTime, s.name, e.name")
        List<Shift> filterWithEmployees​(@Param("tenantId")
                                        Integer tenantId,
                                        @Param("employeeSet")
                                        Set<Employee> employeeSet,
                                        @Param("startDateTime")
                                        OffsetDateTime startDateTime,
                                        @Param("endDateTime")
                                        OffsetDateTime endDateTime)