Commit f9e9d21e authored by KeYong's avatar KeYong

修改CAFS组态页面配置SQL

parent e434e9df
...@@ -1181,7 +1181,7 @@ FROM ...@@ -1181,7 +1181,7 @@ FROM
LEFT JOIN wl_equipment_specific wes ON wes.id = wesi.equipment_specific_id LEFT JOIN wl_equipment_specific wes ON wes.id = wesi.equipment_specific_id
WHERE wesi.equipment_index_key = 'CAFS_FoamAirCompressor_Fault' WHERE wesi.equipment_index_key = 'CAFS_FoamAirCompressor_Fault'
AND wesi.`value` = 'true' AND wesi.`value` = 'true'
AND wes.equipment_code = '92030500MG644' AND wes.equipment_code = '92030700SFT44'
) AS kqysjgz, ) AS kqysjgz,
( (
SELECT SELECT
...@@ -4218,63 +4218,36 @@ ORDER BY ...@@ -4218,63 +4218,36 @@ ORDER BY
DROP VIEW IF EXISTS `v_fire_equip_realtime_status`; DROP VIEW IF EXISTS `v_fire_equip_realtime_status`;
CREATE ALGORITHM = UNDEFINED DEFINER = `root`@`%` SQL SECURITY DEFINER VIEW `v_fire_equip_realtime_status` AS CREATE ALGORITHM = UNDEFINED DEFINER = `root`@`%` SQL SECURITY DEFINER VIEW `v_fire_equip_realtime_status` AS
SELECT SELECT
temp.*, `wes`.`name` AS `equipName`,(
fs.`name` as 'fsname', CASE
fs.`code` as 'fscode', `wes`.`realtime_iot_index_value`
(SELECT WHEN 'true' THEN
IFNULL(SUM(frequency), 0) concat( `wes`.`realtime_iot_index_name`, '(是)' )
FROM WHEN 'false' THEN
wl_equipment_alarm_report_day concat( `wes`.`realtime_iot_index_name`, '(否)' ) ELSE concat( `wes`.`realtime_iot_index_name`, '(', `wes`.`realtime_iot_index_value`, ')' )
WHERE END
equipment_specific_id = temp.equipment_specific_id ) AS `nowStatus`,
AND report_date = CURRENT_DATE) as 'total' `wes`.`realtime_iot_index_update_date` AS `update_date`,(
FROM
(
SELECT SELECT
a.equipment_specific_name AS 'equipName', group_concat( `fs`.`code` SEPARATOR ',' )
(
CASE a.`value`
WHEN 'true' THEN
concat(
a.equipment_index_name,
'(是)'
)
WHEN 'false' THEN
concat(
a.equipment_index_name,
'(否)'
)
END
) AS `nowStatus`,
a.equipment_specific_id,
a.update_date
FROM FROM
wl_equipment_specific_index a, `f_fire_fighting_system` `fs`
WHERE
( (
SELECT 0 <> find_in_set( `fs`.`id`, `wes`.`system_id` ))) AS `fscode`,(
equipment_specific_id, SELECT
MAX(update_date) AS update_date group_concat( `fs`.`name` SEPARATOR ',' )
FROM FROM
wl_equipment_specific_index `f_fire_fighting_system` `fs`
GROUP BY
equipment_specific_id
) b
WHERE WHERE
a.`value` IS NOT NULL (
AND a.equipment_specific_id = b.equipment_specific_id 0 <> find_in_set( `fs`.`id`, `wes`.`system_id` ))) AS `fsname`
AND a.update_date = b.update_date FROM
GROUP BY `wl_equipment_specific` `wes`
a.equipment_specific_id WHERE
ORDER BY ( `wes`.`realtime_iot_es_index_id` IS NOT NULL )
a.update_date DESC ORDER BY
) temp, `wes`.`realtime_iot_index_update_date` DESC
wl_equipment_specific es
LEFT JOIN `f_fire_fighting_system` `fs` ON (
find_in_set(`fs`.`id`, es.system_id)
)
WHERE
temp.equipment_specific_id = es.id
ORDER BY temp.update_date DESC;
-- 系统信息视图 -- 系统信息视图
......
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