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

import com.its.api.its.model.entity.vds.TbVdsDtctMnStat;
import com.its.api.its.model.entity.vds.TbVdsDtctMnStatKey;
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 TbVdsDtctMnStatRepository extends JpaRepository<TbVdsDtctMnStat, TbVdsDtctMnStatKey>, JpaSpecificationExecutor<TbVdsDtctMnStat> {

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

}
