package com.its.api.its.repository.vds;

import com.its.api.its.model.entity.vds.TbVdsDtct15mStat;
import com.its.api.its.model.entity.vds.TbVdsDtct15mStatKey;
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 TbVdsDtct15mStatRepository extends JpaRepository<TbVdsDtct15mStat, TbVdsDtct15mStatKey>, JpaSpecificationExecutor<TbVdsDtct15mStat> {

    @Query("select p from TbVdsDtct15mStat p inner join fetch p.dtct where p.statDt between :fromDt and :toDt and p.dtctNmbr in :ids")
    List<TbVdsDtct15mStat> findAllByDateRange(@Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("ids") List<String> ids);

}
