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

import com.its.op.entity.its.facility.TbFcltSubjPartIn;
import com.its.op.entity.its.facility.TbFcltSubjPartInKey;
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 TbFcltSubjPartInRepository extends JpaRepository<TbFcltSubjPartIn, TbFcltSubjPartInKey>, JpaSpecificationExecutor<TbFcltSubjPartIn> {

    @Query("select p from TbFcltSubjPartIn p")
    List<TbFcltSubjPartIn> findAll();

    @Query("select p from TbFcltSubjPartIn p where p.partNmbr = :partNmbr")
    List<TbFcltSubjPartIn> findAllByPartNmbr(@Param("partNmbr") Long partNmbr);

    @Query("select p from TbFcltSubjPartIn p where p.partNmbr = :partNmbr and p.inDt between :fromDay and :toDay")
    List<TbFcltSubjPartIn> findAllByPartNmbrDateRange(@Param("partNmbr") Long partNmbr, @Param("fromDay") String fromDay, @Param("toDay") String toDay);

}
