package com.its.api.its.repository.ifsc;

import com.its.api.its.model.entity.ifsc.TbIfsc;
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 TbIfscRepository extends JpaRepository<TbIfsc, Long>, JpaSpecificationExecutor<TbIfsc> {

    @Query(value = "select p from TbIfsc p inner join fetch p.fromNode inner join fetch p.toNode")
    List<TbIfsc> findAll();

    @Query(value = "select p from TbIfsc p inner join fetch p.fromNode inner join fetch p.toNode where p.delYn = 'N'")
    List<TbIfsc> findAllList();

    @Query("select count(p.ifscId) from TbIfsc p where p.delYn = 'N'")
    Integer findAllCount();

}
