package com.dacrt.SBIABackend.repository;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.dacrt.SBIABackend.entity.Evalprocrecords;
import com.dacrt.SBIABackend.entity.Evalprocsupliers;
@Repository
public interface EvalprosuppliersRepository extends JpaRepository<Evalprocsupliers,Integer>,JpaSpecificationExecutor<Evalprocsupliers>{
	
boolean existsById(Integer id);
boolean existsByEvalprocessid(int id);
	
	@Query(value=" SELECT u FROM Evalprocsupliers u WHERE u.id= ?1 ")
	Evalprocsupliers getById(int id);
	
	@Query(value=" SELECT max(u.id) FROM Evalprocsupliers u")
	int getMaxRecord();
	
	@Transactional
	@Modifying
	@Query(" DELETE FROM Evalprocsupliers e where e.id = ?1 ")
	void deleteEvalprocSuppliersbyid(Integer id);

}
