INSERT INTO alarm_record (
execution_id, task_id, task_name, alarm_type, alarm_level,
failed_node, failed_node_index, fail_reason, failed_devices, success_devices,
safe_close_status, safe_close_details, notified_channels, notify_status,
tenant_id, created_at
) VALUES (
#{executionId}, #{taskId}, #{taskName}, #{alarmType}, #{alarmLevel},
#{failedNode}, #{failedNodeIndex}, #{failReason}, #{failedDevices}, #{successDevices},
#{safeCloseStatus}, #{safeCloseDetails}, #{notifiedChannels}, #{notifyStatus},
#{tenantId}, NOW()
)
UPDATE alarm_record
notified_channels = #{notifiedChannels},
notify_status = #{notifyStatus},
notify_error = #{notifyError},
handled = #{handled},
handled_by = #{handledBy},
handled_at = #{handledAt},
handle_remark = #{handleRemark},
WHERE id = #{id}
UPDATE alarm_record
SET handled = 1,
handled_by = #{handledBy},
handled_at = NOW(),
handle_remark = #{handleRemark}
WHERE id = #{id}
UPDATE alarm_record
SET notify_status = #{notifyStatus},
notified_channels = #{notifiedChannels}
WHERE id = #{id}
DELETE FROM alarm_record WHERE id = #{id}