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

import com.its.api.its.model.entity.vds.TbVdsDtctRawClct;
import com.its.api.its.model.entity.vds.TbVdsDtctRawClctKey;
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 TbVdsDtctRawClctRepository extends JpaRepository<TbVdsDtctRawClct, TbVdsDtctRawClctKey>, JpaSpecificationExecutor<TbVdsDtctRawClct> {

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

}
