Commit e82157ab authored by 张森's avatar 张森

排油系统API sql修改

parent 7a528508
...@@ -445,14 +445,27 @@ ...@@ -445,14 +445,27 @@
<select id="selectOilDrainageNew" resultType="java.util.Map"> <select id="selectOilDrainageNew" resultType="java.util.Map">
SELECT SELECT
wes.id, wes.id,
'3' as type, '3' AS type,
(SELECT wei.emergency_level FROM wl_equipment_index wei LEFT JOIN wl_equipment_specific_index wesi on wei.id = wesi.equipment_index_id (
WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key) as level, SELECT
wes.code as code , IF
(
wesi.`value` = 'true'
AND wesi.equipment_index_key = 'ONL_DrainOilValve_Open',
( SELECT emergency_level FROM wl_equipment_index WHERE name_key = 'ONL_DrainOilValve_Open' ),
( SELECT emergency_level FROM wl_equipment_index WHERE name_key = 'ONL_DrainOilValve_Close' ))
FROM
wl_equipment_specific_index wesi
WHERE
wesi.equipment_specific_id = wes.id
AND wesi.equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' )
AND wesi.`value` = 'true'
ORDER BY
wesi.update_date DESC
LIMIT 1
) AS level,
wes.CODE AS code,
wes.name, wes.name,
<!-- IFNULL(wes.realtime_iot_index_name,-->
<!-- '暂无信号'-->
<!-- ) AS status,-->
( (
SELECT SELECT
IF IF
...@@ -462,6 +475,7 @@ ...@@ -462,6 +475,7 @@
WHERE WHERE
wesi.equipment_specific_id = wes.id wesi.equipment_specific_id = wes.id
AND wesi.equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' ) AND wesi.equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' )
AND wesi.`value` = 'true'
ORDER BY ORDER BY
wesi.update_date DESC wesi.update_date DESC
LIMIT 1 LIMIT 1
...@@ -474,20 +488,32 @@ ...@@ -474,20 +488,32 @@
<if test="code != null and code!='' "> <if test="code != null and code!='' ">
AND fire.equipment_id = (SELECT id FROM f_equipment WHERE `code` = #{code}) AND fire.equipment_id = (SELECT id FROM f_equipment WHERE `code` = #{code})
</if> </if>
AND wes.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' )
<if test="code != null and code!='' "> <if test="code != null and code!='' ">
union all UNION ALL
( (
SELECT SELECT
wes.id, wes.id,
'3' as type, '3' AS type,
(SELECT wei.emergency_level FROM wl_equipment_index wei LEFT JOIN wl_equipment_specific_index wesi on wei.id = wesi.equipment_index_id (
WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key) as level, SELECT
wes.code as code , IF
(
wesi.`value` = 'true'
AND wesi.equipment_index_key = 'ONL_DrainOilValve_Open',
( SELECT emergency_level FROM wl_equipment_index WHERE name_key = 'ONL_DrainOilValve_Open' ),
( SELECT emergency_level FROM wl_equipment_index WHERE name_key = 'ONL_DrainOilValve_Close' ))
FROM
wl_equipment_specific_index wesi
WHERE
wesi.equipment_specific_id = wes.id
AND wesi.equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' )
AND wesi.`value` = 'true'
ORDER BY
wesi.update_date DESC
LIMIT 1
) AS level,
wes.CODE AS code,
wes.name, wes.name,
<!-- IFNULL(wes.realtime_iot_index_name,-->
<!-- '暂无信号'-->
<!-- ) AS status,-->
( (
SELECT SELECT
IF IF
...@@ -497,6 +523,7 @@ ...@@ -497,6 +523,7 @@
WHERE WHERE
wesi.equipment_specific_id = wes.id wesi.equipment_specific_id = wes.id
AND wesi.equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' ) AND wesi.equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' )
AND wesi.`value` = 'true'
ORDER BY ORDER BY
wesi.update_date DESC wesi.update_date DESC
LIMIT 1 LIMIT 1
...@@ -507,10 +534,8 @@ ...@@ -507,10 +534,8 @@
WHERE WHERE
wes.equipment_code LIKE concat( '921004', '%' ) wes.equipment_code LIKE concat( '921004', '%' )
AND fire.equipment_id != (SELECT id FROM f_equipment WHERE `code` = #{code}) AND fire.equipment_id != (SELECT id FROM f_equipment WHERE `code` = #{code})
AND wes.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' )
) )
</if> </if>
</select> </select>
<select id="selectGasExtinguishing" resultType="java.util.Map"> <select id="selectGasExtinguishing" resultType="java.util.Map">
......
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