package com.its.api.its.repository.road;

import com.its.api.its.model.entity.road.TbRoadTrafHs;
import com.its.api.its.model.entity.road.TbRoadTrafHsKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TbRoadTrafHsRepository extends JpaRepository<TbRoadTrafHs, TbRoadTrafHsKey>, JpaSpecificationExecutor<TbRoadTrafHs> {

    @Query("select p from TbRoadTrafHs p where p.roadId = :roadId and p.prcnDt between :fromDt and :toDt")
    List<TbRoadTrafHs> findAllByDateRange(@Param("roadId") Long roadId, @Param("fromDt") String fromDt, @Param("toDt") String toDt);
}
