|
@@ -20,6 +20,11 @@
|
|
|
<result column="device_name" jdbcType="VARCHAR" property="deviceName"/>
|
|
<result column="device_name" jdbcType="VARCHAR" property="deviceName"/>
|
|
|
<result column="sensor_id" jdbcType="VARCHAR" property="sensorId"/>
|
|
<result column="sensor_id" jdbcType="VARCHAR" property="sensorId"/>
|
|
|
<result column="sensor_name" jdbcType="VARCHAR" property="sensorName"/>
|
|
<result column="sensor_name" jdbcType="VARCHAR" property="sensorName"/>
|
|
|
|
|
+ <result column="sensor_unit" jdbcType="VARCHAR" property="sensorUnit"/>
|
|
|
|
|
+ <result column="data_value" jdbcType="DOUBLE" property="dataValue"/>
|
|
|
|
|
+ <result column="report_time" jdbcType="TIMESTAMP" property="reportTime"/>
|
|
|
|
|
+ <result column="low_value" jdbcType="DOUBLE" property="lowValue"/>
|
|
|
|
|
+ <result column="high_value" jdbcType="DOUBLE" property="highValue"/>
|
|
|
<result column="alarm_level" jdbcType="VARCHAR" property="alarmLevel"/>
|
|
<result column="alarm_level" jdbcType="VARCHAR" property="alarmLevel"/>
|
|
|
<result column="alarm_time" jdbcType="TIMESTAMP" property="alarmTime"/>
|
|
<result column="alarm_time" jdbcType="TIMESTAMP" property="alarmTime"/>
|
|
|
<result column="event_status" jdbcType="INTEGER" property="eventStatus"/>
|
|
<result column="event_status" jdbcType="INTEGER" property="eventStatus"/>
|
|
@@ -63,15 +68,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="finishEvent">
|
|
<update id="finishEvent">
|
|
|
- update t_alarm_event set event_status=1,finish_time=now(),reason=#{reason} where id=#{id}
|
|
|
|
|
|
|
+ update t_alarm_event
|
|
|
|
|
+ set event_status=1,
|
|
|
|
|
+ finish_time=now(),
|
|
|
|
|
+ reason=#{reason}
|
|
|
|
|
+ where id = #{id}
|
|
|
</update>
|
|
</update>
|
|
|
|
|
|
|
|
<update id="setOutliers">
|
|
<update id="setOutliers">
|
|
|
- update t_history_data set status=#{status}
|
|
|
|
|
- where
|
|
|
|
|
- device_id=#{deviceId} and sensor_id=#{sensorId}
|
|
|
|
|
- and report_time <![CDATA[ >= ]]> #{start} and report_time <![CDATA[ <= ]]> #{end}
|
|
|
|
|
|
|
+ update t_history_data
|
|
|
|
|
+ set status=#{status}
|
|
|
|
|
+ where device_id = #{deviceId}
|
|
|
|
|
+ and sensor_id = #{sensorId}
|
|
|
|
|
+ and report_time <![CDATA[ >= ]]> #{start}
|
|
|
|
|
+ and report_time <![CDATA[ <= ]]> #{end}
|
|
|
</update>
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ <select id="getDeviceInfoAndAlarmEvent" resultMap="alarmEventVO">
|
|
|
|
|
+ SELECT t5.id,t1.device_id, t1.device_name,
|
|
|
|
|
+ t1.company_name,t2.sensor_id,t2.sensor_name,t3.data_value,t2.sensor_unit,t3.report_time,t4.low_value,t4.high_value,t5.alarm_time,t5.alarm_level,t5.reason
|
|
|
|
|
+ FROM t_device_info t1
|
|
|
|
|
+ left join t_sensor_info t2 on t1.device_id=t2.device_id
|
|
|
|
|
+ left join t_live_data t3 on t2.device_id=t3.device_id and t2.sensor_id=t3.sensor_id
|
|
|
|
|
+ left join t_device_threshold t4 on t3.device_id=t4.device_id and t3.sensor_id=t4.sensor_id and t4.code=0
|
|
|
|
|
+ left join (select id,device_id,sensor_id,alarm_level,alarm_time,event_status,finish_time,isReport,reason from
|
|
|
|
|
+ t_alarm_event order by alarm_time desc limit 1) t5 on t4.device_id=t5.device_id and t4.sensor_id=t5.sensor_id
|
|
|
|
|
+ where 1=1
|
|
|
|
|
+ <if test="ids !=null and ids.length > 0">
|
|
|
|
|
+ AND t1.company_id in
|
|
|
|
|
+ <foreach collection="ids" item="item" open="(" separator="," close=")" index="index">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="deviceName != null and deviceName != ''">
|
|
|
|
|
+ AND t1.device_name like CONCAT('%', #{deviceName}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="possession != null and possession != ''">
|
|
|
|
|
+ AND t1.possession = #{possession}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
</mapper>
|
|
</mapper>
|