Commit f9e9d21e authored by KeYong's avatar KeYong

修改CAFS组态页面配置SQL

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