package com.reyun.repository;

import com.reyun.model.CallbackDisable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by nolan on 27/12/2016.
 * description:
 */
public interface CallbackDisableRepository extends JpaRepository<CallbackDisable, Long> {
    @Query(value = "select * from callback_disable a where a.app = ?1 and a.channel = ?2", nativeQuery = true)
	List<CallbackDisable> find(Long app, Long channel);

    @Transactional
    @Modifying
    @Query(value = "delete from CallbackDisable a where a.app = ?1 and a.channel = ?2")
    void delete(Long app, Long channel);
}