数据20250916优化-topic订阅失败&数据空报警

This commit is contained in:
2025-09-22 00:40:38 +08:00
parent e93f9cc6b8
commit a5f1444984
9 changed files with 151 additions and 36 deletions

View File

@ -19,12 +19,11 @@
<result property="remark" column="remark" />
<result property="siteId" column="site_id" />
<result property="deviceId" column="device_id" />
<result property="deviceName" column="device_name" />
<result property="ticketNo" column="ticket_no" />
</resultMap>
<sql id="selectEmsAlarmRecordsVo">
select id, device_type, alarm_level, alarm_content, alarm_start_time, alarm_end_time, status, create_by, create_time, update_by, update_time, remark, site_id, device_id, device_name, ticket_no from ems_alarm_records
select id, device_type, alarm_level, alarm_content, alarm_start_time, alarm_end_time, status, create_by, create_time, update_by, update_time, remark, site_id, device_id, ticket_no from ems_alarm_records
</sql>
<select id="selectEmsAlarmRecordsList" parameterType="EmsAlarmRecords" resultMap="EmsAlarmRecordsResult">
@ -38,7 +37,6 @@
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="ticketNo != null and ticketNo != ''"> and ticket_no = #{ticketNo}</if>
</where>
</select>
@ -64,7 +62,6 @@
<if test="remark != null">remark,</if>
<if test="siteId != null">site_id,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="deviceName != null and deviceName != ''">device_name,</if>
<if test="ticketNo != null">ticket_no,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -81,7 +78,6 @@
<if test="remark != null">#{remark},</if>
<if test="siteId != null">#{siteId},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
<if test="ticketNo != null">#{ticketNo},</if>
</trim>
</insert>
@ -102,7 +98,6 @@
<if test="remark != null">remark = #{remark},</if>
<if test="siteId != null">site_id = #{siteId},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
<if test="ticketNo != null">ticket_no = #{ticketNo},</if>
</trim>
where id = #{id}
@ -120,13 +115,13 @@
</delete>
<select id="getAlarmRecordsBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteMonitorHomeAlarmVo">
select device_name as deviceName,
status,
alarm_content as alarmContent,
ticket_no as ticketNo,
id
from ems_alarm_records
where site_id = #{siteId}
select t2.device_name as deviceName,
t.status,
t.alarm_content as alarmContent,
t.ticket_no as ticketNo,
t.id
from ems_alarm_records t INNER JOIN ems_devices_setting t2 on t.site_id = t2.site_id and t.device_id = t2.device_id
where t.site_id = #{siteId}
</select>
<select id="getAlarmTrendList" resultType="com.xzzn.ems.domain.vo.AlarmTrendList">
@ -146,12 +141,14 @@
</select>
<select id="getAlarmRecordDetailList" parameterType="AlarmRecordListRequestVo" resultType="com.xzzn.ems.domain.vo.AlarmRecordListResponseVo">
select t.device_name as deviceName,t.alarm_level as alarmLevel,
t.alarm_content as alarmContent,t.status as status,
t.alarm_start_time as alarmStartTime,t.alarm_end_time as alarmEndTime,
t.ticket_no as ticketNo,
t.id
select t2.device_name as deviceName,
t.alarm_level as alarmLevel,
t.alarm_content as alarmContent,t.status as status,
t.alarm_start_time as alarmStartTime,t.alarm_end_time as alarmEndTime,
t.ticket_no as ticketNo,
t.id
from ems_alarm_records t
INNER JOIN ems_devices_setting t2 on t.site_id = t2.site_id and t.device_id = t2.device_id
where t.site_id = #{siteId}
<if test="deviceType != null and deviceType != ''">
AND t.device_type = #{deviceType}
@ -178,5 +175,15 @@
<select id="getDeviceAlarmNum" resultType="java.lang.Integer">
select COUNT(*) as alarmNum from ems_alarm_records
where site_id = #{siteId} and device_id = #{deviceId}
and status <![CDATA[ != ]]> 1
</select>
<select id="getFailedRecord" resultMap="EmsAlarmRecordsResult">
<include refid="selectEmsAlarmRecordsVo"/>
where site_id = #{siteId}
and device_id = #{deviceId}
and alarm_content = #{content}
and status = #{status}
limit 1
</select>
</mapper>