| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 | 
							- <?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.xunmei.iot.mapper.IotAlarmDataMapper">
 
-     <select id="selectPageList" resultType="com.xunmei.iot.vo.alarm.IotAlarmDataVo">
 
-         SELECT
 
-         a.*,
 
-         b.affiliated_area AS city,
 
-         b.affiliated_bank AS bank,
 
-         b.short_name AS org_name
 
-         FROM
 
-         iot_alarm_data a
 
-         LEFT JOIN sys_org b ON a.org_id = b.id
 
-         where 1=1
 
-         <if test="param.deviceName != null and param.deviceName != ''">
 
-             and a.device_name like concat('%',#{param.deviceName},'%')
 
-         </if>
 
-         <if test="param.orgId != null and param.orgId != ''">
 
-             and a.org_id = #{param.orgId}
 
-         </if>
 
-         <if test="param.orgPath != null and param.orgPath != ''">
 
-             and b.path like concat(#{param.orgPath},'%')
 
-         </if>
 
-         <if test="param.dataType != null">
 
-             and a.data_type = #{param.dataType}
 
-         </if>
 
-         <if test="param.deviceType != null and param.deviceType != ''">
 
-             and a.source_type = #{param.deviceType}
 
-         </if>
 
-         <if test="param.params.alarmStartTime != null">
 
-             and a.time >= #{param.params.alarmStartTime}
 
-         </if>
 
-         <if test="param.params.alarmEndTime != null">
 
-             and a.time <= #{param.params.alarmEndTime}
 
-         </if>
 
-         <if test="param.params.endAlarmStartTime != null">
 
-             and a.end_time >= #{param.params.endAlarmStartTime}
 
-         </if>
 
-         <if test="param.params.endAlarmEndTime != null">
 
-             and a.end_time <= #{param.params.endAlarmEndTime}
 
-         </if>
 
-         <if test="param.params.dealAlarmStartTime != null">
 
-             and a.do_time >= #{param.params.dealAlarmStartTime}
 
-         </if>
 
-         <if test="param.params.dealAlarmEndTime != null">
 
-             and a.do_time <= #{param.params.dealAlarmEndTime}
 
-         </if>
 
-         <if test="param.isDo != null and param.isDo != ''">
 
-             and a.is_do = #{param.isDo}
 
-         </if>
 
-         <if test="param.isDo == 0">
 
-             and a.is_do is null
 
-         </if>
 
-         order by a.end_time ,a.time desc
 
-     </select>
 
-     <select id="selectAppPageList" resultType="com.xunmei.iot.vo.alarmData.AppAlarmDataPageVo">
 
-         SELECT
 
-         a.id,
 
-         a.device_name,
 
-         a.source_type,
 
-         a.source_type_des,
 
-         a.time as start_time,
 
-         a.end_time,
 
-         a.do_time,
 
-         a.do_type,
 
-         a.do_by_user,
 
-         a.do_content,
 
-         b.short_name AS org_name
 
-         FROM
 
-         iot_alarm_data a
 
-         LEFT JOIN sys_org b ON a.org_id = b.id
 
-         where 1=1
 
-         <if test="param.deviceName != null and param.deviceName != ''">
 
-             and a.device_name like concat('%',#{param.deviceName},'%')
 
-         </if>
 
-         <if test="param.orgId != null and param.orgId != ''">
 
-             and a.org_id = #{param.orgId}
 
-         </if>
 
-         <if test="param.orgPath != null and param.orgPath != ''">
 
-             and b.path like concat(#{param.orgPath},'%')
 
-         </if>
 
-         <if test="param.alarmType != null and param.alarmType != ''">
 
-             and a.source_type = #{param.alarmType}
 
-         </if>
 
-         <if test="param.state==0">
 
-             and a.end_time is not null
 
-         </if>
 
-         <if test="param.state==1">
 
-             and a.end_time is null
 
-         </if>
 
-         <if test="param.params != null and param.params.alarmStartTime != null">
 
-             and a.time >= #{param.params.alarmStartTime}
 
-         </if>
 
-         <if test="param.params != null and param.params.alarmEndTime != null">
 
-             and a.time <= #{param.params.alarmEndTime}
 
-         </if>
 
-         <if test="param.isDo != null and param.isDo != ''">
 
-             and a.is_do = #{param.isDo}
 
-         </if>
 
-         <if test="param.isDo == 0">
 
-             and a.is_do is null
 
-         </if>
 
-         order by a.end_time ,a.time desc
 
-     </select>
 
-     <select id="detail" resultType="com.xunmei.iot.vo.alarm.IotAlarmDataVo">
 
-         SELECT a.*,
 
-                b.affiliated_area AS city,
 
-                b.affiliated_bank AS bank,
 
-                b.short_name      AS org_name
 
-         FROM iot_alarm_data a
 
-                  LEFT JOIN sys_org b ON a.org_id = b.id
 
-         where a.id = #{id}
 
-     </select>
 
-     <select id="appBadge" resultType="java.lang.Integer">
 
-         SELECT count(0)
 
-         FROM iot_alarm_data a
 
-         where a.org_id = #{orgId} and a.end_time is null
 
-     </select>
 
-     <select id="selectAlarmDataListByOrgPath" resultType="com.xunmei.common.core.domain.mediator.domain.IotAlarmData">
 
-         select d.* from iot_alarm_data d inner join sys_org o on d.org_id = o.id where o.path like concat(#{orgPath},'%') and o.deleted = 0
 
-         <if test="dataType != null">
 
-             and d.data_type = #{dataType}
 
-         </if>
 
-     </select>
 
-     <select id="selectDeviceTypeCount" resultType="com.xunmei.iot.vo.alarmData.DeviceTypeCountVo">
 
-         SELECT
 
-             s.device_type AS deviceType,
 
-             count(*) AS deviceTypeCount,
 
-             (
 
-             SELECT
 
-                 count(*)
 
-             FROM
 
-                 iot_sensor a
 
-             WHERE
 
-                 a.device_type = s.device_type
 
-                 AND a.state = 1
 
-                 <if test="  query.checkSub != null and query.checkSub == true">
 
-                     and a.org_path like concat(concat('%',#{query.orgPath}),'%')
 
-                 </if>
 
-                 <if test="  query.checkSub != null and query.checkSub == false">
 
-                     and a.org_id = #{query.orgId}
 
-                 </if>
 
-             ) AS deviceTypeAlarmCount
 
-         FROM
 
-             iot_sensor s
 
-         WHERE
 
-             s.deleted = 0
 
-             <if test="  query.checkSub != null and query.checkSub == true">
 
-                 and s.org_path like concat(concat('%',#{query.orgPath}),'%')
 
-             </if>
 
-             <if test="  query.checkSub != null and query.checkSub == false">
 
-                 and s.org_id = #{query.orgId}
 
-             </if>
 
-         GROUP BY
 
-             s.device_type
 
-     </select>
 
-     <select id="selectSensorAlarmPageList" resultType="com.xunmei.iot.vo.alarm.IotAlarmDataVo">
 
-         SELECT
 
-             a.*,
 
-             b.affiliated_area AS city,
 
-             b.affiliated_bank AS bank,
 
-             b.short_name AS org_name
 
-         FROM
 
-             iot_alarm_data a
 
-             LEFT JOIN iot_sensor s ON a.device_id = s.device_code AND a.org_id = s.org_id
 
-             LEFT JOIN sys_org b ON a.org_id = b.id
 
-         WHERE
 
-             1=1
 
-             <if test="param.sensorId != null">
 
-                 and s.id = #{param.sensorId}
 
-             </if>
 
-             <if test="param.deviceName != null and param.deviceName != ''">
 
-                 and s.device_name like concat('%',#{param.deviceName},'%')
 
-             </if>
 
-         ORDER BY
 
-             a.`time` DESC,
 
-             a.end_time DESC
 
-     </select>
 
-     <select id="selectAlarmCount" resultType="java.util.Map">
 
-         select CAST(d.source_type as CHAR) deviceType, CAST(SUM(1) AS CHAR) as nums
 
-         from iot_alarm_data d
 
-                  inner join sys_org o on o.id = d.org_id
 
-         where o.deleted = 0 and data_type=0
 
-           and (
 
-             (
 
-                 #{beginTime}   <![CDATA[<=]]> d.time
 
-                     and now()       <![CDATA[>=]]> d.time
 
-                 )
 
-                 or
 
-             (
 
-                 #{beginTime}   <![CDATA[<=]]> d.end_time
 
-                     and now()       <![CDATA[>=]]> d.end_time
 
-                 )
 
-                 or (
 
-                 #{beginTime}   <![CDATA[>=]]> d.time
 
-                     and now()     <![CDATA[<=]]> d.end_time
 
-                 )
 
-             )
 
-           and o.path like concat(#{orgPath}, '%') and d.source_type is not null
 
-         group by d.source_type
 
-     </select>
 
- </mapper>
 
 
  |