2021-12-10 16:56:39 +08:00
|
|
|
package com.usthe.alert.dao;
|
|
|
|
|
|
2022-01-30 12:11:10 +08:00
|
|
|
import com.usthe.common.entity.alerter.Alert;
|
2021-12-10 16:56:39 +08:00
|
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
|
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
2021-12-19 21:49:19 +08:00
|
|
|
import org.springframework.data.jpa.repository.Modifying;
|
|
|
|
|
import org.springframework.data.jpa.repository.Query;
|
|
|
|
|
import org.springframework.data.repository.query.Param;
|
2021-12-10 16:56:39 +08:00
|
|
|
|
2021-12-19 21:49:19 +08:00
|
|
|
import java.util.List;
|
2021-12-13 14:50:23 +08:00
|
|
|
import java.util.Set;
|
|
|
|
|
|
2021-12-10 16:56:39 +08:00
|
|
|
/**
|
|
|
|
|
* Alert 数据库操作
|
|
|
|
|
* @author tom
|
|
|
|
|
* @date 2021/12/9 10:03
|
|
|
|
|
*/
|
|
|
|
|
public interface AlertDao extends JpaRepository<Alert, Long>, JpaSpecificationExecutor<Alert> {
|
|
|
|
|
|
2021-12-13 14:50:23 +08:00
|
|
|
/**
|
|
|
|
|
* 根据ID列表删除告警
|
|
|
|
|
* @param alertIds 告警ID列表
|
|
|
|
|
*/
|
|
|
|
|
void deleteAlertsByIdIn(Set<Long> alertIds);
|
|
|
|
|
|
2021-12-19 21:49:19 +08:00
|
|
|
/**
|
|
|
|
|
* 根据告警ID-状态值 更新告警状态
|
|
|
|
|
* @param status 状态值
|
|
|
|
|
* @param ids 告警ID列表
|
|
|
|
|
*/
|
|
|
|
|
@Modifying
|
|
|
|
|
@Query("update Alert set status = :status where id in :ids")
|
|
|
|
|
void updateAlertsStatus(@Param(value = "status") Byte status, @Param(value = "ids") List<Long> ids);
|
|
|
|
|
|
2021-12-10 16:56:39 +08:00
|
|
|
}
|