<?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.yeejoin.amos.boot.module.ccs.api.mapper.FireEquipmentSignalMapper">

    <select id="faultEquipTopCount" resultType="java.util.Map">
        SELECT
            count(DISTINCT(a.fire_equipment_mrid)) as total,
            a.equipment_definition_name as name
        FROM
            `asf_fire_equipment_signal_log` a
         where
            year(a.signal_report_date) = YEAR(#{currentDate})
            and a.signal_type = 'faultAlarm'
            group by a.equipment_definition_name
            ORDER BY total desc
            <if test="top != null and top != ''">
                limit #{top}
            </if>
    </select>
</mapper>
