<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zksy.base.warning.mapper.AlarmWarningRelMapper">

    <select id="selectAlarmListByWarningId" resultType="java.util.Map">
        SELECT
            r.*,
            a.device_name,
            a.device_code,
            a.device_type,
            a.warning_type,
            a.warning_code,
            a.actual_value,
            a.alarm_status,
            a.alarm_time
        FROM alarm_warning_rel r
        LEFT JOIN alarm_data a ON r.alarm_id = a.id
        WHERE r.warning_id = #{warningId}
        ORDER BY a.alarm_time DESC
    </select>

</mapper>
