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

import com.its.op.entity.its.atrd.TbAtrd;
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 TbAtrdRepository extends JpaRepository<TbAtrd, String>, JpaSpecificationExecutor<TbAtrd> {

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

    @Query("select count(p.atrdId) from TbAtrd p where p.atrdId = :id")
    Integer findUsageId(@Param("id") String id);
}
