Commit b5db64eb authored by 张森's avatar 张森

youhua

parent 4976bb6d
......@@ -7179,19 +7179,20 @@
SELECT
SUM(
IF
( d.VALUE > 0, 1, 0 )) AS alarmNum,
( d.`value` > 0, 1, 0 )) AS alarmNum,
SUM(
IF
( d.VALUE = 0, 1, 0 )) AS normalNum,
( d.`value` = 0, 1, 0 )) AS normalNum,
count( d.id ) AS total
FROM
(
SELECT
`fs`.`id` AS `id`,
`fs`.`name` AS `name`,
( SELECT count( 1 ) FROM `wl_equipment_specific_alarm` WHERE 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wl_equipment_specific_alarm`.`system_ids` ) AND `wl_equipment_specific_alarm`.`status` = 1 ) AS `value`
IFNULL(sum(sa.`status`), 0) as `value`
FROM
`f_fire_fighting_system` `fs`
left join (select * from wl_equipment_specific_alarm where `status` = 1) sa on find_in_set( `fs`.`id`, sa.`system_ids` )
WHERE
fs.system_type_code IS NOT NULL
AND LENGTH(
......@@ -7199,35 +7200,36 @@
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND fs.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
group by fs.id
) d
</select>
<select id="getSystemTypesNumStats" resultType="Map">
SELECT
d.id,
d.system_type_code AS code,
d.name,
SUM(IF( d.VALUE > 0, 1, 0 )) AS num
FROM (
SELECT
t1.id AS id,
t2.name AS name,
t1.system_type_code,
(SELECT count(1) FROM wl_equipment_specific_alarm t WHERE 0 <![CDATA[<>]]> find_in_set( t1.id, t.system_ids ) AND t.status = 1) AS value
FROM
f_fire_fighting_system t1
LEFT JOIN wl_equipment_category t2 on t1.system_type = t2.id
WHERE
t1.system_type_code IS NOT NULL AND LENGTH(TRIM(t1.system_type_code)) != 0
AND t2.name IS NOT NULL AND LENGTH(TRIM(t2.name)) != 0
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t1.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
) d
t1.id AS id,
t2.`name` AS `name`,
t1.system_type_code as `code`,
sum( sa.`status` ) AS `num`
FROM
f_fire_fighting_system t1
LEFT JOIN wl_equipment_category t2 ON t1.system_type = t2.id
LEFT JOIN ( SELECT `status`, system_ids FROM wl_equipment_specific_alarm WHERE `status` = 1 GROUP BY system_ids ) sa ON find_in_set( t1.id, sa.system_ids )
WHERE
d.value != 0
t1.system_type_code IS NOT NULL
AND LENGTH(
TRIM( t1.system_type_code )) != 0
AND t2.`name` IS NOT NULL
AND LENGTH(
TRIM( t2.`name` )) != 0
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t1.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
GROUP BY
d.system_type_code
t1.system_type_code
HAVING
`num` IS NOT NULL
AND `num` > 0
</select>
<select id="getSystemInfoPage" resultType="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