南昌市物联网技防平台-后台
zengh
2021-03-18 d5a8a64768db15ff6917e150358a954582e384fd
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml
@@ -313,6 +313,7 @@
      left join
       (
       select DATE_FORMAT(alarmTime,'%Y-%m-%d') as datetime, count(*) as count from sys_alarm
           where alarmType = '一键求助'
            group by DATE_FORMAT(alarmTime,'%Y-%m-%d')
       ) b
       on
@@ -320,12 +321,31 @@
    </select>
<!--    &lt;!&ndash;查询本日,本周,本月 主动报警的数量&ndash;&gt;-->
<!--    <select id="selectAlarmSum" resultType="java.util.HashMap">-->
<!--        select sa.alarmType name,IFNULL(sb.count, 0) value from (select alarmType from sys_alarm GROUP BY alarmType) sa-->
<!--        left join-->
<!--        ( select alarmType,count(*) count from sys_alarm-->
<!--        where 1=1-->
<!--        <if test="conditionVo.status==0">-->
<!--            and to_days(alarmTime) = to_days(now())-->
<!--        </if>-->
<!--        <if test="conditionVo.status==1">-->
<!--            and YEARWEEK(date_format(alarmTime,'%Y-%m-%d'),1) = YEARWEEK(now(),1)-->
<!--        </if>-->
<!--        <if test="conditionVo.status==2">-->
<!--            and date_format(alarmTime,'%Y%m') = date_format(now(),'%Y%m')-->
<!--        </if>-->
<!--        group by alarmType-->
<!--        ) sb-->
<!--        on-->
<!--        sa.alarmType = sb.alarmType-->
<!--    </select>-->
    <!--查询本日,本周,本月 主动报警的数量-->
    <select id="selectAlarmSum" resultType="java.util.HashMap">
        select sa.alarmType name,IFNULL(sb.count, 0) value from (select alarmType from sys_alarm GROUP BY alarmType) sa
        left join
        ( select alarmType,count(*) count from sys_alarm
        where 1=1
        select '一键求助' name,ifnull(count(*),0 ) value from sys_alarm
        where alarmType = '一键求助'
        <if test="conditionVo.status==0">
            and to_days(alarmTime) = to_days(now())
        </if>
@@ -335,10 +355,19 @@
        <if test="conditionVo.status==2">
            and date_format(alarmTime,'%Y%m') = date_format(now(),'%Y%m')
        </if>
        group by alarmType
        ) sb
        on
        sa.alarmType = sb.alarmType
        union all
        select '电话报警' name,ifnull(count(*),0 ) value from sys_alarm
        where alarmType = '电话报警'
        <if test="conditionVo.status==0">
            and to_days(alarmTime) = to_days(now())
        </if>
        <if test="conditionVo.status==1">
            and YEARWEEK(date_format(alarmTime,'%Y-%m-%d'),1) = YEARWEEK(now(),1)
        </if>
        <if test="conditionVo.status==2">
            and date_format(alarmTime,'%Y%m') = date_format(now(),'%Y%m')
        </if>
    </select>
    <select id="queryPolice" resultType="java.util.HashMap">