fix: 应该每次电话报警,就新增条消息,不能每次超过阈值就生成一条报警。

This commit is contained in:
tianyongbao
2026-03-18 22:36:13 +08:00
parent 01c039f249
commit c16580ac82
2 changed files with 68 additions and 5 deletions

View File

@@ -1,8 +1,12 @@
package com.intc.fishery.mapper;
package com.intc.fishery.mapper;
import com.intc.common.mybatis.core.mapper.BaseMapperPlusJoin;
import com.intc.fishery.domain.MessageWarn;
import com.intc.fishery.domain.vo.MessageWarnVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
/**
* 设备告警记录Mapper接口
@@ -12,4 +16,18 @@ import com.intc.fishery.domain.vo.MessageWarnVo;
*/
public interface MessageWarnMapper extends BaseMapperPlusJoin<MessageWarn, MessageWarnVo> {
/**
* 查询指定设备、告警标题、时间范围内的告警消息数量
* 用于对未开启电话通知的告警类型做时间窗口抑制,避免每次超阈值都重复写入记录
*
* @param deviceId 设备ID
* @param title 告警标题
* @param afterTime 起始时间
* @return 满足条件的告警消息数量
*/
@Select("SELECT COUNT(1) FROM aqu_message_warn WHERE device_id = #{deviceId} AND title = #{title} AND create_time >= #{afterTime}")
long countByDeviceAndTitleAfter(@Param("deviceId") Long deviceId,
@Param("title") String title,
@Param("afterTime") Date afterTime);
}