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`
) AS `total`,
`rd`.`report_date` AS `report_date`, `rd`.`report_date` AS `report_date`,
`fs`.`name` AS `fightSysName`, `fs`.`name` AS `fightSysName`,
`fs`.`code` AS `fightSysCode`, `fs`.`code` AS `fightSysCode`,
`fs`.`id` AS `fightSysId`, `fs`.`id` AS `fightSysId`,
rd.equipment_specific_id AS equipId `rd`.`equipment_id` AS `equipId`
FROM FROM
( ((
`wl_equipment_alarm_report_day` `rd` `wl_equipment_alarm_report_day` `rd`
LEFT JOIN `f_fire_fighting_system` `fs` ON ( LEFT JOIN `f_fire_fighting_system` `fs` ON ((
( 0 <> find_in_set( `fs`.`id`, `rd`.`system_ids` ))))
0 <> find_in_set( LEFT JOIN `wl_equipment` `we` ON ((
`fs`.`id`, `we`.`id` = `rd`.`equipment_id`
`rd`.`system_ids` )))
)
)
)
)
WHERE WHERE
( (((
( curdate() - INTERVAL 30 DAY
(curdate() - INTERVAL 30 DAY) <= cast(`rd`.`report_date` AS date) ) <= cast( `rd`.`report_date` AS date ))
) AND ( `fs`.`code` = '011023306003010000000129' )
AND ( AND ((
-- 此处需要更改为换流变的系统code
`fs`.`code` = '011023306003010000000129'
)
AND (
(
`rd`.`index_type` LIKE '%Fault' `rd`.`index_type` LIKE '%Fault'
) )
OR ( OR ( `rd`.`index_type` LIKE '%FireAlarm' )
`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`
) `a` ) `a`
GROUP BY a.equipId GROUP BY
ORDER BY total DESC `a`.`equipId`
ORDER BY
`total` DESC
LIMIT 5; 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
) AS `status`,
`b`.`totalNum` AS `totalNum`
FROM
( (
SELECT SELECT
wesl.id AS `id`, `a`.`speId` AS `speId`,
a.equipName, `a`.`equipName` AS `equipName`,
count( wesl.id ) AS totalNum count(wesl.equipment_specific_id) as totalNum
FROM FROM
( (
SELECT SELECT
wes.`name` AS equipName, `wes`.`id` AS `speId`,
wed.equipment_id AS equipmentId `wed`.`equipment_name` AS `equipName`,
`wed`.`equipment_id` AS `equipmentId`
FROM FROM
wl_equipment_specific wes (
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id `wl_equipment_specific` `wes`
LEFT JOIN `wl_equipment_detail` `wed` ON ((
`wed`.`id` = `wes`.`equipment_detail_id`
)))
WHERE WHERE
--此处需要更改为水喷雾系统id ( find_in_set( '1657264678908', `wes`.`system_id` ) > 0 )
FIND_IN_SET( '1619086103649', wes.system_id ) > 0
GROUP BY GROUP BY
wed.equipment_id `wed`.`equipment_id`
) a ) `a`
LEFT JOIN wl_equipment_specific_alarm_log wesl ON wesl.equipment_id = a.equipmentId LEFT JOIN `wl_equipment_specific_alarm_log` `wesl` ON `wesl`.`equipment_specific_id` = `a`.`speId`
GROUP BY GROUP BY
a.equipmentId `a`.`equipmentId`
) b; ) 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`,
......
...@@ -255,12 +255,8 @@ ...@@ -255,12 +255,8 @@
</select> </select>
<select id="pageAlarmsInfo" resultType="Map"> <select id="pageAlarmsInfo" resultType="Map">
SELECT SELECT
d.*
FROM
(
SELECT
wlesal.id AS alarmId, wlesal.id AS alarmId,
wlesal.org_code, wlesal.org_code AS orgCode,
wlesal.equipment_specific_id AS fireEquipmentId, wlesal.equipment_specific_id AS fireEquipmentId,
wlesal.equipment_detail_id AS equipDetailId, wlesal.equipment_detail_id AS equipDetailId,
wlesal.equipment_specific_code AS fireEquipmentCode, wlesal.equipment_specific_code AS fireEquipmentCode,
...@@ -300,7 +296,7 @@ ...@@ -300,7 +296,7 @@
END AS fireEquipmentPointValue, END AS fireEquipmentPointValue,
wlesa.frequency AS frequency, wlesa.frequency AS frequency,
wlesal.status AS status, wlesal.status AS status,
wlesal.type AS type, wlesal.type AS `type`,
(select type_name from wl_signal_classify sc where sc.type_code = wlesal.type limit 1) as alarmType, (select type_name from wl_signal_classify sc where sc.type_code = wlesal.type limit 1) as alarmType,
wlesal.create_date AS createDate, wlesal.create_date AS createDate,
wlesal.build_id AS buildId, wlesal.build_id AS buildId,
...@@ -319,65 +315,62 @@ ...@@ -319,65 +315,62 @@
FROM FROM
wl_equipment_specific_alarm_log wlesal wl_equipment_specific_alarm_log wlesal
LEFT JOIN wl_equipment we ON wlesal.equipment_code = we.code LEFT JOIN wl_equipment we ON wlesal.equipment_code = we.code
LEFT JOIN wl_equipment_specific_alarm wlesa ON wlesa.id = wlesal.equipment_specific_alarm_id) d LEFT JOIN wl_equipment_specific_alarm wlesa ON wlesa.id = wlesal.equipment_specific_alarm_id
<where> <where>
<if test="param.warehouseStructureName != null and param.warehouseStructureName != ''"> <if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">
d.warehouseStructureName like wlesal.location like concat(concat("%",#{param.warehouseStructureName}),"%")
concat(concat("%",#{param.warehouseStructureName}),"%")
</if> </if>
<if test="param.equipCode != null and param.equipCode != ''">AND d.fireEquipmentCode like <if test="param.equipCode != null and param.equipCode != ''">
concat(concat("%",#{param.equipCode}),"%") AND wlesal.equipment_specific_code like concat(concat("%",#{param.equipCode}),"%")
</if> </if>
<choose> <if test="param.confirmType != null and param.confirmType != '' and param.confirmType == 1">
<when test="param.confirmType != null and param.confirmType != '' and param.confirmType == 1"> AND wlesal.confirm_type <![CDATA[<>]]> ''
AND d.handleType <![CDATA[<>]]> '' </if>
</when> <if test="param.confirmType != null and param.confirmType != '' and param.confirmType == 0">
<when test="param.confirmType != null and param.confirmType != '' and param.confirmType == 0"> AND wlesal.confirm_type IS NULL
AND d.handleType IS NULL </if>
</when> <if test="param.confirmType != null and param.confirmType != '' and param.confirmType == 2">
<when test="param.confirmType != null and param.confirmType != '' and param.confirmType == 2"> AND wlesal.clean_time IS NULL
AND d.cleanStatus = '未消除' </if>
</when> <if test="param.confirmType != null and param.confirmType != '' and param.confirmType == 3">
<when test="param.confirmType != null and param.confirmType != '' and param.confirmType == 3"> AND wlesal.clean_time IS NOT NULL
AND d.cleanStatus = '已消除' </if>
</when> <if test="param.beginDate!=null">AND wlesal.create_date <![CDATA[>=]]> #{param.beginDate}</if>
</choose> <if test="param.endDate!=null">AND wlesal.create_date <![CDATA[<=]]> #{param.endDate}</if>
<if test="param.beginDate!=null">AND d.createDate <![CDATA[>=]]> #{param.beginDate}</if> <if test="param.alarmType != null and param.alarmType != ''">AND wlesal.type = #{param.alarmType}</if>
<if test="param.endDate!=null">AND d.createDate <![CDATA[<=]]> #{param.endDate}</if>
<if test="param.alarmType != null and param.alarmType != ''">AND d.type = #{param.alarmType}</if>
<if test="param.systemCode != null and param.systemCode != ''"> <if test="param.systemCode != null and param.systemCode != ''">
AND find_in_set(#{param.systemCode},d.systemCodes) AND find_in_set(#{param.systemCode}, wlesal.system_codes)
</if> </if>
<if test="param.buildId != null and param.buildId != ''"> <if test="param.buildId != null and param.buildId != ''">
and (d.buildId=#{param.buildId} and (wlesal.build_id=#{param.buildId}
or find_in_set(d.fireEquipmentId,(SELECT s.point_in_scene FROM `wl_source_scene` s where s.source_id = or find_in_set(wlesal.equipment_specific_id, (SELECT s.point_in_scene FROM `wl_source_scene` s where s.source_id =
#{param.buildId}))) #{param.buildId})))
</if> </if>
<if test="param.id!=null and param.id!=''">AND d.fireEquipmentId = #{param.id}</if> <if test="param.id!=null and param.id!=''">AND wlesal.equipment_specific_id = #{param.id}</if>
<if test="param.status!=null and param.status!=3">AND d.status = #{param.status}</if> <if test="param.status!=null and param.status!=3">AND wlesal.status = #{param.status}</if>
<if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 1">AND <if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 1">AND
d.cleanStatus = '已消除' wlesal.clean_time IS NOT NULL
</if> </if>
<if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 2">AND <if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 2">AND
d.cleanStatus = '未消除' wlesal.clean_time IS NULL
</if> </if>
<if test="param.isRemoveShield != null and param.isRemoveShield != ''">AND <if test="param.isRemoveShield != null and param.isRemoveShield != ''">AND
d.type != 'SHIELD' wlesal.type != 'SHIELD'
</if> </if>
<if test="param.isRemovedFire != null and param.isRemovedFire == 1">AND <if test="param.isRemovedFire != null and param.isRemovedFire == 1">AND
d.type != 'FIREALARM' wlesal.type != 'FIREALARM'
</if> </if>
<if test="param.equipmentCode != null and param.equipmentCode != ''"> <if test="param.equipmentCode != null and param.equipmentCode != ''">
AND d.equipmentCode like concat(concat("%",#{param.equipmentCode}),"%") AND wlesal.equipment_code like concat(concat("%",#{param.equipmentCode}),"%")
</if> </if>
<if test="param.indexTypeCode != null and param.indexTypeCode != ''"> <if test="param.indexTypeCode != null and param.indexTypeCode != ''">
AND d.type = #{param.indexTypeCode} AND wlesal.type = #{param.indexTypeCode}
</if> </if>
<if test="param.fireEquipmentSpecificIndexKey != null and param.fireEquipmentSpecificIndexKey != ''"> <if test="param.fireEquipmentSpecificIndexKey != null and param.fireEquipmentSpecificIndexKey != ''">
AND d.fireEquipmentSpecificIndexKey like concat(concat("%",#{param.fireEquipmentSpecificIndexKey}),"%") AND wlesal.equipment_specific_index_key like concat(concat("%",#{param.fireEquipmentSpecificIndexKey}),"%")
</if> </if>
</where> </where>
ORDER BY d.createDate DESC ORDER BY wlesal.create_date DESC
</select> </select>
<select id="getAlarmList" resultType="java.util.HashMap"> <select id="getAlarmList" resultType="java.util.HashMap">
SELECT SELECT
......
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