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

import com.its.api.its.model.entity.vds.TbVdsDtctHhStat;
import com.its.api.its.model.entity.vds.TbVdsDtctHhStatKey;
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 TbVdsDtctHhStatRepository extends JpaRepository<TbVdsDtctHhStat, TbVdsDtctHhStatKey>, JpaSpecificationExecutor<TbVdsDtctHhStat> {

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

}
