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

import com.its.op.entity.its.facility.TbFcltSubjPartOut;
import com.its.op.entity.its.facility.TbFcltSubjPartOutKey;
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 TbFcltSubjPartOutRepository extends JpaRepository<TbFcltSubjPartOut, TbFcltSubjPartOutKey>, JpaSpecificationExecutor<TbFcltSubjPartOut> {

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

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

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

}
