Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
gassafety
Commits
1531fe5b
Commit
1531fe5b
authored
Oct 19, 2021
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据监测取最新数据问题修改 gengdidi
parent
1c132af4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
33 deletions
+55
-33
TDeviceReportDataMapper.xml
.../main/resources/mapper/system/TDeviceReportDataMapper.xml
+55
-33
No files found.
gassafety-system/src/main/resources/mapper/system/TDeviceReportDataMapper.xml
View file @
1531fe5b
...
...
@@ -86,41 +86,63 @@ 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.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
SELECT
*
FROM
(
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
(
d.device_type = '3'
OR d.device_type = '4'
)
ORDER BY t.create_time DESC
)data
<where>
<if
test=
"deviceCode != null and deviceCode != ''"
>
and d.device_code like concat('%',#{deviceCode},'%')
</if>
<if
test=
"deviceType != null and deviceType != ''"
>
and d.device_type = #{deviceType}
</if>
<if
test=
"deviceType == null "
>
and (d
.device_type = '3' or d
.device_type = '4')
</if>
<if
test=
"startReportTime != null "
>
and
t.report
_time
>
= #{startReportTime}
</if>
<if
test=
"endReportTime != null "
>
and
t.report
_time
<
= #{endReportTime}
</if>
<if
test=
"communicationStatus != null and communicationStatus != ''"
>
and
t
.communication_status = #{communicationStatus}
</if>
<if
test=
"deviceStatus != null and deviceStatus != ''"
>
and
t
.device_status = #{deviceStatus}
</if>
<if
test=
"deviceCode != null and deviceCode != ''"
>
and d
ata
.device_code like concat('%',#{deviceCode},'%')
</if>
<if
test=
"deviceType != null and deviceType != ''"
>
and d
ata
.device_type = #{deviceType}
</if>
<if
test=
"deviceType == null "
>
and (d
ata.device_type = '3' or data
.device_type = '4')
</if>
<if
test=
"startReportTime != null "
>
and
data.create
_time
>
= #{startReportTime}
</if>
<if
test=
"endReportTime != null "
>
and
data.create
_time
<
= #{endReportTime}
</if>
<if
test=
"communicationStatus != null and communicationStatus != ''"
>
and
data
.communication_status = #{communicationStatus}
</if>
<if
test=
"deviceStatus != null and deviceStatus != ''"
>
and
data
.device_status = #{deviceStatus}
</if>
</where>
group by d
.device_id
GROUP BY data
.device_id
</select>
<select
id=
"selectTDeviceReportDataByDeviceNum"
parameterType=
"String"
resultMap=
"TDeviceReportDataResult"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment