fix: 设备在离线,溶解氧和温度报警逻辑修改。
This commit is contained in:
@@ -3,6 +3,10 @@ package com.intc.iot.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.intc.iot.domain.AquWarnCallNotice;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 告警电话通知记录 Mapper
|
||||
@@ -11,4 +15,41 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
*/
|
||||
@Mapper
|
||||
public interface AquWarnCallNoticeMapper extends BaseMapper<AquWarnCallNotice> {
|
||||
|
||||
/**
|
||||
* 查询指定设备、告警标题、时间范围内的通知数量(通过关联表反查 title)
|
||||
*
|
||||
* @param deviceId 设备ID
|
||||
* @param title 告警标题(如"溶解氧"、"设备离线"等)
|
||||
* @param afterTime 起始时间
|
||||
* @return 满足条件的通知数量
|
||||
*/
|
||||
@Select("SELECT COUNT(1) FROM aqu_call_notice n " +
|
||||
"INNER JOIN aqu_map_message_warn_call_notice m ON m.call_notice_id = n.id " +
|
||||
"INNER JOIN aqu_message_warn w ON w.id = m.message_warn_id " +
|
||||
"WHERE n.device_id = #{deviceId} " +
|
||||
"AND w.title = #{title} " +
|
||||
"AND n.call_time >= #{afterTime}")
|
||||
long countByDeviceAndTitleAfter(@Param("deviceId") Long deviceId,
|
||||
@Param("title") String title,
|
||||
@Param("afterTime") LocalDateTime afterTime);
|
||||
|
||||
/**
|
||||
* 查询指定设备、告警标题、时段范围内的通知数量(免打扰模式:每个时段只通知一次)
|
||||
* 时段划分:08:00-14:00、14:00-20:00、20:00-08:00
|
||||
*
|
||||
* @param deviceId 设备ID
|
||||
* @param title 告警标题
|
||||
* @param periodStart 当前时段起始时间
|
||||
* @return 满足条件的通知数量
|
||||
*/
|
||||
@Select("SELECT COUNT(1) FROM aqu_call_notice n " +
|
||||
"INNER JOIN aqu_map_message_warn_call_notice m ON m.call_notice_id = n.id " +
|
||||
"INNER JOIN aqu_message_warn w ON w.id = m.message_warn_id " +
|
||||
"WHERE n.device_id = #{deviceId} " +
|
||||
"AND w.title = #{title} " +
|
||||
"AND n.call_time >= #{periodStart}")
|
||||
long countByDeviceAndTitleInPeriod(@Param("deviceId") Long deviceId,
|
||||
@Param("title") String title,
|
||||
@Param("periodStart") LocalDateTime periodStart);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user