package com.its.api.its.repository.link;

import com.its.api.its.model.entity.link.TbLinkSyopTraf;
import com.its.api.its.model.entity.link.TbLinkSyopTrafKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TbLinkSyopTrafRepository extends JpaRepository<TbLinkSyopTraf, TbLinkSyopTrafKey>, JpaSpecificationExecutor<TbLinkSyopTraf> {

    @Query( "select p from TbLinkSyopTraf p inner join fetch p.link l inner join fetch l.fromNode fn inner join fetch l.toNode tn " +
            " where p.aplyEndDt >= to_char(sysdate, 'YYYYMMDDHH24MISS')")
    List<TbLinkSyopTraf> findAllCurrent();

}
