Commit a4c08983 authored by 耿迪迪's avatar 耿迪迪

实时数据设备状态修改 gengdidi

parent b8e9aa0a
......@@ -49,8 +49,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectTDeviceReportDataList" parameterType="DeviceReportDataForm" resultMap="TDeviceReportDataResultVo">
select t.report_time, t.device_report_data_id, t.device_num, t.standard_condition_accumulation, t.working_condition_accumulation, t.residual_quantity, t.standard_condition_flow, t.working_condition_flow, t.temperature, t.pressure, t.communication_status, t.device_status, t.create_time, t.update_time,
d.device_id, d.device_name, d.device_code, d.device_type, d.device_model
select
t.report_time,
t.device_report_data_id,
t.device_num,
t.standard_condition_accumulation,
t.working_condition_accumulation,
t.residual_quantity,
t.standard_condition_flow,
t.working_condition_flow,
t.temperature,
t.pressure,
t.communication_status,
t.create_time,
t.update_time,
d.device_id,
d.device_name,
d.device_code,
d.device_type,
d.device_model,
CASE (SELECT COUNT(DISTINCT alarm.device_id) FROM t_device_alarm alarm WHERE alarm.device_id = d.device_id AND alarm.end_time IS NULL)
WHEN 0 THEN '正常'
ELSE '报警'
END as device_status
from t_device_report_data t
left join t_device_info d on t.device_num = d.iot_no
<where>
......@@ -64,10 +85,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectRealtimeDataList" parameterType="DeviceReportDataForm" resultMap="TDeviceReportDataResultVo">
select max(t.report_time) report_time, t.device_report_data_id, t.device_num, t.standard_condition_accumulation, t.working_condition_accumulation, t.residual_quantity, t.standard_condition_flow, t.working_condition_flow, t.temperature, t.pressure, t.communication_status, t.device_status, t.create_time, t.update_time,
d.device_id, d.device_name, d.device_code, d.device_type, d.device_model
select
max(t.report_time) report_time,
t.device_report_data_id,
t.device_num,
t.standard_condition_accumulation,
t.working_condition_accumulation,
t.residual_quantity,
t.standard_condition_flow,
t.working_condition_flow,
t.temperature,
t.pressure,
t.communication_status,
t.create_time,
t.update_time,
d.device_id,
d.device_name,
d.device_code,
d.device_type,
d.device_model,
CASE (SELECT COUNT(DISTINCT alarm.device_id) FROM t_device_alarm alarm WHERE alarm.device_id = d.device_id AND alarm.end_time IS NULL)
WHEN 0 THEN '正常'
ELSE '报警'
END as device_status
from t_device_report_data t
right join t_device_info d on t.device_num = d.iot_no
LEFT JOIN t_device_info d on t.device_num = d.iot_no
<where>
<if test="deviceCode != null "> and d.device_code like concat('%',#{deviceCode},'%')</if>
<if test="deviceType != null "> and d.device_type = #{deviceType}</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment