南昌市物联网技防平台-后台
Administrator
2021-04-08 2c2b1ab406d3049a0e69fff01e3daade5cbe90ea
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml
@@ -80,6 +80,20 @@
        <if test="alarm.endTime!=null and alarm.endTime!=''">
            and a.alarmTime&lt;=#{alarm.endTime}
        </if>
        <if test="alarm.timeDesc!=null and alarm.timeDesc!=''">
            <if test="alarm.timeDesc=='30分钟以上'">
                and czTime-alarmTime>1800
            </if>
            <if test="alarm.timeDesc=='10-30分钟'">
                and czTime-alarmTime>600 and czTime-alarmTime &lt;1800
            </if>
            <if test="alarm.timeDesc=='5-10分钟'">
                and czTime-alarmTime>300 and czTime-alarmTime &lt;600
            </if>
            <if test="alarm.timeDesc=='小于5分钟'">
                and czTime-alarmTime>0 and czTime-alarmTime &lt;300
            </if>
        </if>
        and a.waringType IN("紧急求救")
@@ -298,8 +312,12 @@
        SELECT count(*) FROM `sys_alarm`
            where
        waringType = '紧急求救'
            and
        to_days(alarmTime) = to_days(curdate())
        <if test="conditionVo.status==0">
            and to_days(alarmTime) = to_days(curdate())
        </if>
        <if test="conditionVo.startTime!=null and conditionVo.startTime!='' and conditionVo.endTime!=null and conditionVo.endTime!=''">
            and alarmTime between #{conditionVo.startTime} and #{conditionVo.endTime}
        </if>
    </select>
@@ -330,26 +348,6 @@
       on
       a.click_date = b.datetime
       order by a.click_date asc
    </select>
    <!--查询警情当前时间段内每天的数据-->
    <select id="selectTimeAlarmData" resultType="java.lang.Integer">
       select a.days, ifnull(count,0) count from
            (
                SELECT @date := DATE_ADD( @date, INTERVAL + 1 DAY ) days FROM
                (
                    SELECT @date := DATE_ADD( #{conditionVo.startTime}, INTERVAL - 1 DAY ) FROM sys_date
                ) time
                    WHERE to_days( @date ) &lt; to_days( #{conditionVo.endTime} )
            ) a
            left join
            (
            select DATE_FORMAT(alarmTime,'%Y-%m-%d') as datetime, count(*) as count from sys_alarm
            where waringType = '紧急求救'
            group by DATE_FORMAT(alarmTime,'%Y-%m-%d')
            ) b
            on
            a.days = b.datetime
    </select>
<!--    &lt;!&ndash;查询本日,本周,本月 主动报警的数量&ndash;&gt;-->
@@ -493,28 +491,5 @@
        ) b
        on
        a.days = b.datetime
    </select>
    <!--查询本年所有月份的预警数量-->
    <select id="queryYearAlarm" resultType="java.util.HashMap">
        <if test="childList!=null and childList.size>0">
            <foreach collection="childList" index="index" item="item" open="" separator="union all" close="">
                SELECT
                #{item} as month,count(ce.id) as count
                FROM
                sys_alarm as ce
                WHERE
                YEAR ( alarmTime ) = date_format(now(),'%Y%')
                AND MONTH ( alarmTime ) = #{item}
                AND waringType = "紧急求救"
                AND deviceNumber = #{deviceNumber}
            </foreach>
        </if>
    </select>
</mapper>