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`,
......
...@@ -255,129 +255,122 @@ ...@@ -255,129 +255,122 @@
</select> </select>
<select id="pageAlarmsInfo" resultType="Map"> <select id="pageAlarmsInfo" resultType="Map">
SELECT SELECT
d.* wlesal.id AS alarmId,
FROM wlesal.org_code AS orgCode,
( wlesal.equipment_specific_id AS fireEquipmentId,
SELECT wlesal.equipment_detail_id AS equipDetailId,
wlesal.id AS alarmId, wlesal.equipment_specific_code AS fireEquipmentCode,
wlesal.org_code, wlesal.equipment_specific_name AS fireEquipmentName,
wlesal.equipment_specific_id AS fireEquipmentId, concat(
wlesal.equipment_detail_id AS equipDetailId, wlesal.equipment_specific_name,
wlesal.equipment_specific_code AS fireEquipmentCode, wlesal.equipment_specific_index_name
wlesal.equipment_specific_name AS fireEquipmentName, ) AS alamContent,
concat( IF (
wlesal.equipment_specific_name, wlesal.confirm_type <![CDATA[<>]]> '',
wlesal.equipment_specific_index_name '已处理',
) AS alamContent, '未处理'
IF ( ) handleStatus,
wlesal.confirm_type <![CDATA[<>]]> '', IF (
'已处理', wlesal.clean_time IS NOT NULL,
'未处理' '已消除',
) handleStatus, '未消除'
IF ( ) cleanStatus,
wlesal.clean_time IS NOT NULL, IF (
'已消除', wlesal.clean_time IS NOT NULL,
'未消除' '1',
) cleanStatus, '2'
IF ( ) cleanStatusVal,
wlesal.clean_time IS NOT NULL, wlesal.confirm_type AS handleType,
'1', wlesal.system_codes AS systemCodes,
'2' wlesal.equipment_index_id AS fireEquipmentIndexId,
) cleanStatusVal, wlesal.equipment_specific_index_key AS fireEquipmentSpecificIndexKey,
wlesal.confirm_type AS handleType, wlesal.equipment_specific_index_name AS fireEquipmentSpecificIndexName,
wlesal.system_codes AS systemCodes, we.img AS imgUrl,
wlesal.equipment_index_id AS fireEquipmentIndexId, CASE wlesal.equipment_specific_index_value
wlesal.equipment_specific_index_key AS fireEquipmentSpecificIndexKey, WHEN 'true' THEN
wlesal.equipment_specific_index_name AS fireEquipmentSpecificIndexName, '是'
we.img AS imgUrl, WHEN 'false' THEN
CASE wlesal.equipment_specific_index_value '否'
WHEN 'true' THEN ELSE
'是' wlesal.equipment_specific_index_value
WHEN 'false' THEN END AS fireEquipmentPointValue,
'否' wlesa.frequency AS frequency,
ELSE wlesal.status AS status,
wlesal.equipment_specific_index_value wlesal.type AS `type`,
END AS fireEquipmentPointValue, (select type_name from wl_signal_classify sc where sc.type_code = wlesal.type limit 1) as alarmType,
wlesa.frequency AS frequency, wlesal.create_date AS createDate,
wlesal.status AS status, wlesal.build_id AS buildId,
wlesal.type AS type, wlesa.recovery_date AS recoveryDate,
(select type_name from wl_signal_classify sc where sc.type_code = wlesal.type limit 1) as alarmType, wlesal.location AS warehouseStructureName,
wlesal.create_date AS createDate, (
wlesal.build_id AS buildId, SELECT
wlesa.recovery_date AS recoveryDate, group_concat(fet.`name`)
wlesal.location AS warehouseStructureName, FROM
( f_equipment_fire_equipment AS fefe
SELECT LEFT JOIN f_equipment AS fet ON fet.id = fefe.equipment_id
group_concat(fet.`name`) WHERE
FROM fefe.fire_equipment_id = wlesal.equipment_specific_id
f_equipment_fire_equipment AS fefe ) AS equipmentName,
LEFT JOIN f_equipment AS fet ON fet.id = fefe.equipment_id wlesal.equipment_code AS equipmentCode
WHERE
fefe.fire_equipment_id = wlesal.equipment_specific_id
) AS equipmentName,
wlesal.equipment_code AS equipmentCode
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 != ''">
<if test="param.equipCode != null and param.equipCode != ''">AND d.fireEquipmentCode like AND wlesal.equipment_specific_code like concat(concat("%",#{param.equipCode}),"%")
concat(concat("%",#{param.equipCode}),"%") </if>
</if> <if test="param.confirmType != null and param.confirmType != '' and param.confirmType == 1">
<choose> AND wlesal.confirm_type <![CDATA[<>]]> ''
<when test="param.confirmType != null and param.confirmType != '' and param.confirmType == 1"> </if>
AND d.handleType <![CDATA[<>]]> '' <if test="param.confirmType != null and param.confirmType != '' and param.confirmType == 0">
</when> AND wlesal.confirm_type IS NULL
<when test="param.confirmType != null and param.confirmType != '' and param.confirmType == 0"> </if>
AND d.handleType IS NULL <if test="param.confirmType != null and param.confirmType != '' and param.confirmType == 2">
</when> AND wlesal.clean_time IS NULL
<when test="param.confirmType != null and param.confirmType != '' and param.confirmType == 2"> </if>
AND d.cleanStatus = '未消除' <if test="param.confirmType != null and param.confirmType != '' and param.confirmType == 3">
</when> AND wlesal.clean_time IS NOT NULL
<when test="param.confirmType != null and param.confirmType != '' and param.confirmType == 3"> </if>
AND d.cleanStatus = '已消除' <if test="param.beginDate!=null">AND wlesal.create_date <![CDATA[>=]]> #{param.beginDate}</if>
</when> <if test="param.endDate!=null">AND wlesal.create_date <![CDATA[<=]]> #{param.endDate}</if>
</choose> <if test="param.alarmType != null and param.alarmType != ''">AND wlesal.type = #{param.alarmType}</if>
<if test="param.beginDate!=null">AND d.createDate <![CDATA[>=]]> #{param.beginDate}</if> <if test="param.systemCode != null and param.systemCode != ''">
<if test="param.endDate!=null">AND d.createDate <![CDATA[<=]]> #{param.endDate}</if> AND find_in_set(#{param.systemCode}, wlesal.system_codes)
<if test="param.alarmType != null and param.alarmType != ''">AND d.type = #{param.alarmType}</if> </if>
<if test="param.systemCode != null and param.systemCode != ''"> <if test="param.buildId != null and param.buildId != ''">
AND find_in_set(#{param.systemCode},d.systemCodes) and (wlesal.build_id=#{param.buildId}
</if> or find_in_set(wlesal.equipment_specific_id, (SELECT s.point_in_scene FROM `wl_source_scene` s where s.source_id =
<if test="param.buildId != null and param.buildId != ''"> #{param.buildId})))
and (d.buildId=#{param.buildId} </if>
or find_in_set(d.fireEquipmentId,(SELECT s.point_in_scene FROM `wl_source_scene` s where s.source_id = <if test="param.id!=null and param.id!=''">AND wlesal.equipment_specific_id = #{param.id}</if>
#{param.buildId}))) <if test="param.status!=null and param.status!=3">AND wlesal.status = #{param.status}</if>
</if> <if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 1">AND
<if test="param.id!=null and param.id!=''">AND d.fireEquipmentId = #{param.id}</if> wlesal.clean_time IS NOT NULL
<if test="param.status!=null and param.status!=3">AND d.status = #{param.status}</if> </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 == 2">AND
d.cleanStatus = '已消除' wlesal.clean_time IS NULL
</if> </if>
<if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 2">AND <if test="param.isRemoveShield != null and param.isRemoveShield != ''">AND
d.cleanStatus = '未消除' wlesal.type != 'SHIELD'
</if> </if>
<if test="param.isRemoveShield != null and param.isRemoveShield != ''">AND <if test="param.isRemovedFire != null and param.isRemovedFire == 1">AND
d.type != 'SHIELD' wlesal.type != 'FIREALARM'
</if> </if>
<if test="param.isRemovedFire != null and param.isRemovedFire == 1">AND <if test="param.equipmentCode != null and param.equipmentCode != ''">
d.type != 'FIREALARM' AND wlesal.equipment_code like concat(concat("%",#{param.equipmentCode}),"%")
</if> </if>
<if test="param.equipmentCode != null and param.equipmentCode != ''"> <if test="param.indexTypeCode != null and param.indexTypeCode != ''">
AND d.equipmentCode like concat(concat("%",#{param.equipmentCode}),"%") AND wlesal.type = #{param.indexTypeCode}
</if> </if>
<if test="param.indexTypeCode != null and param.indexTypeCode != ''"> <if test="param.fireEquipmentSpecificIndexKey != null and param.fireEquipmentSpecificIndexKey != ''">
AND d.type = #{param.indexTypeCode} AND wlesal.equipment_specific_index_key like concat(concat("%",#{param.fireEquipmentSpecificIndexKey}),"%")
</if> </if>
<if test="param.fireEquipmentSpecificIndexKey != null and param.fireEquipmentSpecificIndexKey != ''">
AND d.fireEquipmentSpecificIndexKey like concat(concat("%",#{param.fireEquipmentSpecificIndexKey}),"%")
</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