package com.its.api.its.repository.facility;

import com.its.api.its.model.entity.facility.TbFcltFailRparHs;
import com.its.api.its.model.entity.facility.TbFcltFailRparHsKey;
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.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TbFcltFailRparHsRepository extends JpaRepository<TbFcltFailRparHs, TbFcltFailRparHsKey>, JpaSpecificationExecutor<TbFcltFailRparHs> {

    @Query("select p from TbFcltFailRparHs p where p.failHsSeq = :failHsSeq")
    List<TbFcltFailRparHs> findAllFailHsList(@Param("failHsSeq") String failHsSeq);

    @Modifying
    @Query("delete from TbFcltFailRparHs p where p.failHsSeq = :failHsSeq")
    void deleteDataById(@Param("failHsSeq") String failHsSeq);

}
