package com.qqchen.deploy.backend.deploy.repository;

import com.qqchen.deploy.backend.deploy.entity.ServerAlertRule;
import com.qqchen.deploy.backend.framework.repository.IBaseRepository;
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;

/**
 * 服务器告警规则Repository
 */
@Repository
public interface IServerAlertRuleRepository extends IBaseRepository<ServerAlertRule, Long> {

    /**
     * 删除指定服务器的所有告警规则
     */
    @Modifying
    @Query("DELETE FROM ServerAlertRule r WHERE r.serverId = :serverId")
    int deleteByServerId(@Param("serverId") Long serverId);
}
