Commit f4a9ecae authored by KeYong's avatar KeYong

修改bug

parent 2c86bdef
...@@ -7450,100 +7450,93 @@ WHERE ...@@ -7450,100 +7450,93 @@ WHERE
DROP VIEW IF EXISTS `v_fire_equip_alarm_fss_top5_3small`; DROP VIEW IF EXISTS `v_fire_equip_alarm_fss_top5_3small`;
CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_fss_top5_3small` AS CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_fss_top5_3small` AS
SELECT SELECT
ifnull(`a`.`fightSysName`, NULL) AS `fightSysName`, ifnull( `a`.`fightSysName`, NULL ) AS `fightSysName`,
ifnull(`a`.`fightSysCode`, NULL) AS `fightSysCode`, ifnull( `a`.`fightSysCode`, NULL ) AS `fightSysCode`,
ifnull(`a`.`fightSysId`, NULL) AS `fightSysId`, ifnull( `a`.`fightSysId`, NULL ) AS `fightSysId`,
ifnull(`a`.`report_date`, NULL) AS `reportDate`, ifnull( `a`.`report_date`, NULL ) AS `reportDate`,
a.equipName, `a`.`equipName` AS `equipName`,
sum(`a`.`total`) AS `total` sum( `a`.`total` ) AS `total`
FROM FROM
( (
SELECT SELECT
`rd`.`index_type` AS `indxKey`, `rd`.`index_type` AS `indxKey`,
`rd`.`index_name` AS `index_name`, `rd`.`index_name` AS `index_name`,
`rd`.`equipment_specific_name` AS `equipName`, `we`.`name` AS `equipName`,
count( count( DISTINCT `rd`.`equipment_specific_id` ) AS `total`,
DISTINCT `rd`.`equipment_specific_id` `rd`.`report_date` AS `report_date`,
) AS `total`, `fs`.`name` AS `fightSysName`,
`rd`.`report_date` AS `report_date`, `fs`.`code` AS `fightSysCode`,
`fs`.`name` AS `fightSysName`, `fs`.`id` AS `fightSysId`,
`fs`.`code` AS `fightSysCode`, `rd`.`equipment_id` AS `equipId`
`fs`.`id` AS `fightSysId`, FROM
rd.equipment_specific_id AS equipId ((
FROM `wl_equipment_alarm_report_day` `rd`
( LEFT JOIN `f_fire_fighting_system` `fs` ON ((
`wl_equipment_alarm_report_day` `rd` 0 <> find_in_set( `fs`.`id`, `rd`.`system_ids` ))))
LEFT JOIN `f_fire_fighting_system` `fs` ON ( LEFT JOIN `wl_equipment` `we` ON ((
( `we`.`id` = `rd`.`equipment_id`
0 <> find_in_set( )))
`fs`.`id`, WHERE
`rd`.`system_ids` (((
) curdate() - INTERVAL 30 DAY
) ) <= cast( `rd`.`report_date` AS date ))
) AND ( `fs`.`code` = '011023306003010000000129' )
) AND ((
WHERE `rd`.`index_type` LIKE '%Fault'
( )
( OR ( `rd`.`index_type` LIKE '%FireAlarm' )
(curdate() - INTERVAL 30 DAY) <= cast(`rd`.`report_date` AS date) OR ( `rd`.`index_type` LIKE '%Shield' )))
) GROUP BY
AND ( `rd`.`equipment_specific_id`,
-- 此处需要更改为换流变的系统code `rd`.`report_date`
`fs`.`code` = '011023306003010000000129' ) `a`
) GROUP BY
AND ( `a`.`equipId`
( ORDER BY
`rd`.`index_type` LIKE '%Fault' `total` DESC
) LIMIT 5;
OR (
`rd`.`index_type` LIKE '%FireAlarm'
)
OR (
`rd`.`index_type` LIKE '%Shield'
)
)
AND (`rd`.`value` = 'true')
)
GROUP BY
`rd`.`equipment_specific_id`,
`rd`.`report_date`
) `a`
GROUP BY a.equipId
ORDER BY total DESC
LIMIT 5;
-- 换流变水喷雾系统3小设备状态统计视图 -- 换流变水喷雾系统3小设备状态统计视图
DROP VIEW IF EXISTS `v_fire_equip_alarm_fss_3small`; DROP VIEW IF EXISTS `v_fire_equip_alarm_fss_3small`;
CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_fss_3small` AS CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_fss_3small` AS
SELECT SELECT
b.id AS `id`, `b`.`speId` AS `id`,
b.equipName, `b`.`equipName` AS `equipName`,(
( CASE WHEN b.totalNum > 0 THEN '异常' ELSE '正常' END ) `status`, CASE
b.totalNum AS totalNum WHEN ( `b`.`totalNum` > 0 ) THEN
FROM '异常' ELSE '正常'
( END
SELECT ) AS `status`,
wesl.id AS `id`, `b`.`totalNum` AS `totalNum`
a.equipName,
count( wesl.id ) AS totalNum
FROM FROM
( (
SELECT SELECT
wes.`name` AS equipName, `a`.`speId` AS `speId`,
wed.equipment_id AS equipmentId `a`.`equipName` AS `equipName`,
count(wesl.equipment_specific_id) as totalNum
FROM FROM
wl_equipment_specific wes (
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id SELECT
WHERE `wes`.`id` AS `speId`,
--此处需要更改为水喷雾系统id `wed`.`equipment_name` AS `equipName`,
FIND_IN_SET( '1619086103649', wes.system_id ) > 0 `wed`.`equipment_id` AS `equipmentId`
GROUP BY FROM
wed.equipment_id (
) a `wl_equipment_specific` `wes`
LEFT JOIN wl_equipment_specific_alarm_log wesl ON wesl.equipment_id = a.equipmentId LEFT JOIN `wl_equipment_detail` `wed` ON ((
GROUP BY `wed`.`id` = `wes`.`equipment_detail_id`
a.equipmentId )))
) b; WHERE
( find_in_set( '1657264678908', `wes`.`system_id` ) > 0 )
GROUP BY
`wed`.`equipment_id`
) `a`
LEFT JOIN `wl_equipment_specific_alarm_log` `wesl` ON `wesl`.`equipment_specific_id` = `a`.`speId`
GROUP BY
`a`.`equipmentId`
) b
ORDER BY
`b`.`totalNum` DESC;
-- 换流变水喷雾系统4小设备状态统计视图 -- 换流变水喷雾系统4小设备状态统计视图
DROP VIEW IF EXISTS `v_fire_equip_status_fss`; DROP VIEW IF EXISTS `v_fire_equip_status_fss`;
...@@ -7674,8 +7667,7 @@ FROM ...@@ -7674,8 +7667,7 @@ FROM
`rd`.`index_type` LIKE '%Fault' `rd`.`index_type` LIKE '%Fault'
) )
OR ( `rd`.`index_type` LIKE '%FireAlarm' ) OR ( `rd`.`index_type` LIKE '%FireAlarm' )
OR ( `rd`.`index_type` LIKE '%Shield' )) OR ( `rd`.`index_type` LIKE '%Shield' )))
AND ( `rd`.`value` = 'true' ))
GROUP BY GROUP BY
`rd`.`equipment_specific_id`, `rd`.`equipment_specific_id`,
`rd`.`report_date`, `rd`.`report_date`,
......
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