package com.its.api.its.repository.vms;

import com.its.api.its.model.entity.vms.TbVmsCtrlHs;
import com.its.api.its.model.entity.vms.TbVmsCtrlHsKey;
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 TbVmsCtrlHsRepository extends JpaRepository<TbVmsCtrlHs, TbVmsCtrlHsKey>, JpaSpecificationExecutor<TbVmsCtrlHs> {

    @Query("select p from TbVmsCtrlHs p inner join fetch p.vms where p.ctlDt between :fromDt and :toDt and p.vmsCtlrNmbr in :ids")
    List<TbVmsCtrlHs> findAllByDateRange(@Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("ids") List<Long> ids);

}
