package com.its.op.dao.repository.its.rse;

import com.its.op.entity.its.rse.TbRseCtlrCnncHs;
import com.its.op.entity.its.rse.TbRseSectTrafHs;
import com.its.op.entity.its.rse.TbRseSectTrafHsKey;
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 TbRseSectTrafHsRepository extends JpaRepository<TbRseSectTrafHs, TbRseSectTrafHsKey>, JpaSpecificationExecutor<TbRseSectTrafHs> {

    @Query("select p from TbRseSectTrafHs p")
    List<TbRseSectTrafHs> findAll();

    @Query("select p from TbRseSectTrafHs p")
    List<TbRseSectTrafHs> findAllList();

    @Query("select p from TbRseSectTrafHs p inner join fetch p.rse where p.prcnDt between :fromDt and :toDt and p.rseSectId in :ids")
    List<TbRseSectTrafHs> findAllByDateRange(@Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("ids") List<Long> ids);

}
