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

import com.its.op.entity.its.link.TbLinkParaDetl;
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 org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface TbLinkParaDetlRepository extends JpaRepository<TbLinkParaDetl, Long>, JpaSpecificationExecutor<TbLinkParaDetl> {

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

    @Transactional
    @Modifying
    @Query("delete from TbLinkParaDetl p where p.paraId = :paraId")
    void deleteDataById(@Param("paraId") Long paraId);
}
