Commit 6da481b5 authored by maoying's avatar maoying

修改组态系统信息查询脚本

parent ecfcf673
......@@ -2347,46 +2347,77 @@
<select id="getSystemAlarmInfo" resultType="java.util.Map">
SELECT
`fs`.`id` AS `id`,
`fs`.`name` AS `name`,
count( `wes`.`id` ) AS `totalEquipNum`,(
SELECT
count( DISTINCT `eqlog`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log` `eqlog`
WHERE
((
0 != find_in_set( `fs`.`id`, `eqlog`.`system_ids` ))
AND (
`eqlog`.`create_date` LIKE concat( date_format( curdate(), '%Y-%m-%d' ), '%' )))) AS `todayAlarmNum`,
IF
(((
SELECT
count( `eqlog`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log` `eqlog`
WHERE
((
0 != find_in_set( `fs`.`id`, `eqlog`.`system_ids` ))
AND ( `eqlog`.`status` = 1 ))) > 0
),
'异常',
'正常'
) AS `stateDesc`,
IFNULL(ec.image, "") AS image
FROM
`f_fire_fighting_system` `fs`
LEFT JOIN `wl_equipment_specific` `wes` ON (
0 != find_in_set( `fs`.`id`, `wes`.`system_id` ))
LEFT JOIN wl_equipment_category ec ON ec.id = fs.system_type
`fs`.`id` AS `id`,
`fs`.`name` AS `name`,
(
SELECT
count(1)
FROM
`wl_equipment_specific` `wes`
WHERE
0 != find_in_set(
`fs`.`id`,
`wes`.`system_id`
)
) AS `totalEquipNum`,
(
SELECT
count(
DISTINCT `eqlog`.`equipment_specific_id`
)
FROM
`wl_equipment_specific_alarm_log` `eqlog`
WHERE
(
(
0 != find_in_set(
`fs`.`id`,
`eqlog`.`system_ids`
)
)
AND (
`eqlog`.`create_date` LIKE concat(
date_format(curdate(), '%Y-%m-%d'),
'%'
)
)
)
) AS `todayAlarmNum`,
IF (
(
(
SELECT
count(
`esa`.`equipment_specific_id`
)
FROM
`wl_equipment_specific_alarm` `esa`
WHERE
(
(
0 != find_in_set(
`fs`.`id`,
`esa`.`system_ids`
)
)
AND (`esa`.`status` = 1)
)
) > 0
),
'异常',
'正常'
) AS `stateDesc`,
IFNULL(ec.image, "") AS image
FROM
`f_fire_fighting_system` `fs`
LEFT JOIN wl_equipment_category ec ON ec.id = fs.system_type
<where>
1=1
<if test="bizOrgCode!=null and bizOrgCode!=''">
and fs.biz_org_code = #{bizOrgCode,jdbcType=VARCHAR}
</if>
</where>
GROUP BY
`fs`.`id`
ORDER BY fs.sort
</select>
<select id="getEquipAlarmInfoNum" resultType="java.util.Map">
......
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