package com.its.api.its.repository.vds;

import com.its.api.its.model.entity.vds.TbVdsCtlr;
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 TbVdsCtlrRepository extends JpaRepository<TbVdsCtlr, String>, JpaSpecificationExecutor<TbVdsCtlr> {

    @Query("select p from TbVdsCtlr p left outer join fetch p.state")
    List<TbVdsCtlr> findAll();

    @Query("select p from TbVdsCtlr p left outer join fetch p.state where p.delYn = 'N'")
    List<TbVdsCtlr> findAllList();

    @Query("select count(p.ctlrMngmNmbr) as total from TbVdsCtlr p where p.delYn = 'N'")
    Integer findAllListCount();

}
