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

import com.its.api.its.model.entity.vms.TbVmsForm;
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 TbVmsFormRepository extends JpaRepository<TbVmsForm, Integer>, JpaSpecificationExecutor<TbVmsForm> {

    @Query("select p from TbVmsForm p where p.vmsTypeCd = :vmsTypeCd")
    List<TbVmsForm> findAllByVmsType(@Param("vmsTypeCd") String vmsTypeCd);

    @Query("select p from TbVmsForm p where p.vmsTypeCd = :vmsTypeCd and p.vmsFormTypeCd in :formTypeCd")
    List<TbVmsForm> findAllByVmsTypeAndFormType(@Param("vmsTypeCd") String vmsTypeCd, @Param("formTypeCd") List<Integer> formTypeCd);

}
