Newer
Older
zq-big-sreen / target / classes / mapper / tilt / TiltDataMapper.xml
casic_zt on 28 May 2024 1 KB 大屏统计数据不对修改
<?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.casic.dao.spantilt.TiltDataMapper">

    <select id="countColudDevice" resultType="Integer">
        SELECT  count(*)
        FROM   bus_monipoi_info
        WHERE  VALID='1'
    </select>

    <select id="countColudAlarm" resultType="Integer">
        SELECT   SUM(case ar.count  WHEN  '0'   THEN  '0'  ELSE  '1' END)  AS  count
        from (
        SELECT  count(ar.id)  AS  count
        FROM bus_monipoi_info bmi
        LEFT JOIN alarm_record ar ON ar.DEVICE_CODE=bmi.DEVICE_CODE
        WHERE bmi.VALID='1'
        GROUP BY  ar.DEVICE_CODE)  ar
        <if test="beginTime != null and beginTime != '' ">
            and ar.ALARM_TIME <![CDATA[ >= ]]>
            TO_CHAR(#{beginTime},'yyyy-MM-dd HH24:mi:ss')
        </if>
        <if test="endTime != null and endTime != ''">
            and ar.ALARM_TIME  <![CDATA[ <= ]]>
            TO_CHAR(#{endTime},'yyyy-MM-dd HH24:mi:ss')
        </if>
    </select>

    <select id="countColudAlarmRecords" resultType="map">
        SELECT bsi.STATION_NAME as "stationName",count(ar.Id) AS total
        FROM bus_monipoi_info bmi
        LEFT JOIN alarm_record ar ON ar.DEVICE_CODE=bmi.DEVICE_CODE
        LEFT JOIN bus_station_info bsi ON bsi.ID=bmi.STATION_ID
        WHERE bmi.VALID='1'
        <if test="beginTime != null and beginTime != '' ">
            and ar.ALARM_TIME <![CDATA[ >= ]]>
            TO_CHAR(#{beginTime},'yyyy-MM-dd HH24:mi:ss')
        </if>
        <if test="endTime != null and endTime != ''">
            and ar.ALARM_TIME  <![CDATA[ <= ]]>
            TO_CHAR(#{endTime},'yyyy-MM-dd HH24:mi:ss')
        </if>
        GROUP BY bmi.STATION_ID
    </select>

</mapper>