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

import com.its.op.entity.its.vds.TbVdsDtctClct;
import com.its.op.entity.its.vds.TbVdsDtctClctKey;
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 TbVdsDtctClctRepository extends JpaRepository<TbVdsDtctClct, TbVdsDtctClctKey>, JpaSpecificationExecutor<TbVdsDtctClct> {

    @Query("select p from TbVdsDtctClct p inner join fetch p.dtct m inner join fetch m.vds where p.clctDt between :fromDt and :toDt and p.vdsDtctNmbr in :ids")
    List<TbVdsDtctClct> findAllByDateRange(@Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("ids") List<Long> ids);

}
