Commit fa4e9e03 authored by maoying's avatar maoying

修复监控屏风险点,巡检点个数及详情接口

parent e6e1c7da
......@@ -124,7 +124,9 @@
) isBound
from
f_fire_equipment_point as a
left join f_dict fd on fd.id = a.alarm_type
<where>
fd.dict_value = 'alarm_type_trouble'
<if test="equipmentId!=null">
and a.fire_equipment_id = #{equipmentId}
</if>
......
......@@ -367,13 +367,12 @@
<select id="countUpperRiskPoint" resultType="long">
SELECT
count(DISTINCT frcl.id)
count(DISTINCT frcl.risk_source_id)
FROM
(
SELECT
a.id,
a.risk_source_id,
date_format(a.create_date, '%Y-%m-%d') AS create_date
a.risk_source_id
FROM
`f_rpn_change_log` a,
`f_risk_source` b
......@@ -381,25 +380,21 @@
a.type = #{type}
and a.risk_source_id = b.id
and b.org_code = #{orgCode}
and date_format(a.create_date, '%Y-%m-%d') = #{date}
) as frcl
WHERE
frcl.create_date = #{date}
</select>
<select id="countCheckException" resultType="long">
select count(distinct pt.point_id) from
(
SELECT
a.id,
DATE_FORMAT(b.begin_time,'%Y-%m-%d') as begin_date,
DATE_FORMAT(b.end_time,'%Y-%m-%d') as end_date,
a.point_id
FROM `p_plan_task_detail` a , p_plan_task b
where
a.task_no = b.id
and a.`status` in ('2','3')
and (b.org_code = #{orgCode} OR b.org_code like CONCAT(#{orgCode},'-%'))
) pt
where #{date} BETWEEN pt.begin_date and pt.end_date
SELECT
count(distinct pc.point_id)
FROM
p_check pc
WHERE
DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
AND pc.`is_ok` = '2'
</select>
<select id="countFireException" resultType="long">
......@@ -416,41 +411,43 @@
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo" >
SELECT
b.id,
a.`name`,
a.risk_level_id as riskLevelId,
b.create_date as changeDate
FROM
f_risk_source a,
(SELECT a.id,a.type,a.risk_source_id,max(a.create_date) as create_date FROM `f_rpn_change_log` a GROUP BY a.risk_source_id) as b
WHERE
b.risk_source_id = a.id
AND b.type = '0'
and a.org_code = #{orgCode}
and DATE_FORMAT(b.create_date,'%Y-%m-%d') = #{date}
rcl.id,
rcl.create_date AS changeDate,
rs.risk_level_id AS riskLevelId,
rs.`name`
FROM
(
SELECT DISTINCT
risk_source_id,
MAX(create_date) create_date,
MAX(id) id
FROM
f_rpn_change_log
WHERE
type = '0'
AND DATE_FORMAT(create_date, '%Y-%m-%d') = #{date}
) rcl
LEFT JOIN f_risk_source rs ON rs.id = rcl.risk_source_id
WHERE
rs.org_code = #{orgCode}
</select>
<select id="getAllErrorPatrolPoint" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
SELECT
pc.id,
b.`name`,
pc.`is_ok` as status,
pc.check_time as changeDate
pc.point_id id,
pc.point_name 'name',
pc.`is_ok` as status,
max(pc.check_time) as changeDate
FROM
(select
a.id,
a.point_id,
a.`is_ok`,
max(a.check_time) as check_time
FROM
p_check a
where DATE_FORMAT(a.check_time,'%Y-%m-%d') = #{date}
and a.`is_ok` IN ('2', '3')
GROUP BY a.point_id) as pc,
p_point b
p_check pc
WHERE
pc.point_id = b.id
and b.is_delete = false
and b.org_code = #{orgCode}
DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
AND pc.`is_ok` = '2'
GROUP BY pc.point_id,pc.`is_ok`,pc.point_name
</select>
<select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
......
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