Commit 813058a3 authored by litengwei's avatar litengwei

全景监控设备动作信号修改添加动作类信号筛选

parent aa932249
......@@ -6,1059 +6,1037 @@
<select id="getSafetyIndexWeek" resultType="java.util.HashMap">
<![CDATA[
SELECT distinct temp1.*,IFNULL(S.safety_index,0) as value
FROM (
SELECT @s :=@s + 1 as `index`, DATE(DATE_SUB(CURRENT_DATE, INTERVAL @s DAY)) AS date
FROM mysql.help_topic,(SELECT @s := 0) temp
) temp1
left join f_safety_index_change_log S on S.collect_date = temp1.date
where temp1.index < 8
ORDER BY temp1.date
]]>
SELECT distinct temp1.*, IFNULL(S.safety_index, 0) as value
FROM (
SELECT @s := @s + 1 as `index`, DATE (DATE_SUB(CURRENT_DATE, INTERVAL @s DAY)) AS date
FROM mysql.help_topic, (SELECT @s := 0) temp
) temp1
left join f_safety_index_change_log S
on S.collect_date = temp1.date
where temp1.index < 8
ORDER BY temp1.date
]]>
</select>
<select id="countUpperRiskPoint" resultType="long">
SELECT
count(DISTINCT frcl.risk_source_id)
FROM
(
SELECT
a.id,
a.risk_source_id
FROM
`f_rpn_change_log` a,
`f_risk_source` b
WHERE
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}
and b.risk_level_id is not NULL
) as frcl
</select>
SELECT count(DISTINCT frcl.risk_source_id)
FROM (
SELECT a.id,
a.risk_source_id
FROM `f_rpn_change_log` a,
`f_risk_source` b
WHERE 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}
and b.risk_level_id is not NULL
) as frcl
</select>
<select id="countCheckException" resultType="long">
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 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">
SELECT
count(1)
FROM
wl_equipment_specific_alarm a
WHERE
status = 1
AND org_code = #{orgCode}
AND type = 'BREAKDOWN'
AND date_format(a.update_date, '%Y-%m-%d') = #{date}
</select>
SELECT count(1)
FROM wl_equipment_specific_alarm a
WHERE status = 1
AND org_code = #{orgCode}
AND type = 'BREAKDOWN'
AND date_format(a.update_date, '%Y-%m-%d') = #{date}
</select>
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo">
SELECT
rcl.id,
rcl.create_date AS changeDate,
rs.risk_level_id AS riskLevelId,
rs.`name`
FROM
(
SELECT
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}
group by risk_source_id
) rcl
LEFT JOIN f_risk_source rs ON rs.id = rcl.risk_source_id
WHERE rs.risk_level_id is not NULL
AND (rs.org_code = #{orgCode} OR rs.org_code like CONCAT(#{orgCode},'-%'))
SELECT rcl.id,
rcl.create_date AS changeDate,
rs.risk_level_id AS riskLevelId,
rs.`name`
FROM (
SELECT 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}
group by risk_source_id
) rcl
LEFT JOIN f_risk_source rs ON rs.id = rcl.risk_source_id
WHERE rs.risk_level_id is not NULL
AND (rs.org_code = #{orgCode} OR rs.org_code like CONCAT(#{orgCode}, '-%'))
</select>
</select>
<select id="getAllErrorPatrolPoint" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
SELECT
pc.point_id id,
pc.point_name 'name',
pc.`is_ok` as status,
max(pc.check_time) as changeDate
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'
GROUP BY pc.point_id,pc.`is_ok`,pc.point_name
</select>
SELECT pc.point_id id,
pc.point_name 'name',
pc.`is_ok` as status,
max(pc.check_time) as changeDate
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'
GROUP BY pc.point_id, pc.`is_ok`, pc.point_name
</select>
<select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
select
ala.id,
ala.equipment_specific_name as name,
cate.name as status,
ala.update_date as changeDate
from
wl_equipment_specific_alarm as ala
left join wl_equipment_specific as spe on ala.equipment_specific_id = spe.id
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on equ.id = det.equipment_id
left join wl_equipment_category as cate on equ.category_id = cate.id
where ala.status = TRUE
AND ala.type = 'alarm_type_trouble'
AND ala.org_code = #{orgCode}
AND date_format(ala.update_date, '%Y-%m-%d') = #{date}
select ala.id,
ala.equipment_specific_name as name,
cate.name as status,
ala.update_date as changeDate
from wl_equipment_specific_alarm as ala
left join wl_equipment_specific as spe on ala.equipment_specific_id = spe.id
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on equ.id = det.equipment_id
left join wl_equipment_category as cate on equ.category_id = cate.id
where ala.status = TRUE
AND ala.type = 'alarm_type_trouble'
AND ala.org_code = #{orgCode}
AND date_format(ala.update_date, '%Y-%m-%d') = #{date}
</select>
</select>
<select id="getStatisticsCheck" resultType="java.util.HashMap">
<![CDATA[
SELECT
(
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 )
FROM
`p_plan_task`
WHERE
(
`p_plan_task`.`check_date` LIKE concat( curdate(), '%' ))) AS `point_num`,(
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 )
FROM
`p_plan_task`
WHERE
((
`p_plan_task`.`finish_status` = 3
)
AND (
`p_plan_task`.`check_date` LIKE concat( curdate(), '%' )))) AS `miss_num`,(
SELECT
count( 1 ) AS `total_num`
FROM
(
SELECT
`b`.`id` AS `id`
FROM
`p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE
`b`.`is_finish` = 1 AND c.is_ok = 1 AND `a`.`check_date` = curdate()
ORDER BY
`b`.`id`
) `t` ) AS `ok_num`,(
SELECT
count( 1 ) AS `total_num`
FROM
(
SELECT
`b`.`id` AS `id`
FROM
`p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE
`b`.`is_finish` = 1 AND c.is_ok = 2 AND `a`.`check_date` = curdate()
ORDER BY
`b`.`id`
) `t` ) AS `notOk_num`,(
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 )
FROM
`p_plan_task`
WHERE
((
`p_plan_task`.`finish_status` = 0
)
AND (
`p_plan_task`.`check_date` LIKE concat( curdate(), '%' )))) AS `notStart_num`
]]>
SELECT (
SELECT ifnull(sum(`p_plan_task`.`point_num`), 0)
FROM `p_plan_task`
WHERE (
`p_plan_task`.`check_date` LIKE concat(curdate(), '%'))) AS `point_num`,
(
SELECT ifnull(sum(`p_plan_task`.`point_num`), 0)
FROM `p_plan_task`
WHERE ((
`p_plan_task`.`finish_status` = 3
)
AND (
`p_plan_task`.`check_date` LIKE concat(curdate(), '%')))) AS `miss_num`,
(
SELECT count(1) AS `total_num`
FROM (
SELECT `b`.`id` AS `id`
FROM `p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE `b`.`is_finish` = 1
AND c.is_ok = 1
AND `a`.`check_date` = curdate()
ORDER BY `b`.`id`
) `t`) AS `ok_num`,
(
SELECT count(1) AS `total_num`
FROM (
SELECT `b`.`id` AS `id`
FROM `p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE `b`.`is_finish` = 1
AND c.is_ok = 2
AND `a`.`check_date` = curdate()
ORDER BY `b`.`id`
) `t`) AS `notOk_num`,
(
SELECT ifnull(sum(`p_plan_task`.`point_num`), 0)
FROM `p_plan_task`
WHERE ((
`p_plan_task`.`finish_status` = 0
)
AND (
`p_plan_task`.`check_date` LIKE concat(curdate(), '%')))) AS `notStart_num`
]]>
</select>
<select id="getRiskErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT n.id,r.code,r.name as label,r.id as pointId,'risk' as type,n.create_date as changeDate
FROM f_rpn_change_log n
LEFT JOIN f_risk_source r ON r.id = n.risk_source_id
WHERE n.type = 0
ORDER BY n.create_date desc
limit 0,5
</select>
SELECT n.id, r.code, r.name as label, r.id as pointId, 'risk' as type, n.create_date as changeDate
FROM f_rpn_change_log n
LEFT JOIN f_risk_source r ON r.id = n.risk_source_id
WHERE n.type = 0
ORDER BY n.create_date desc limit 0,5
</select>
<select id="getCheckErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT p.id,I.point_no as code,
IF(p.is_ok = '2', CONCAT(I.name,' 不合格') ,CONCAT(I.name,' 漏检') ) as label,
p.point_id,'patrol' as type,p.check_time as changeDate
FROM p_check p
left join p_point I ON I.id = p.point_id
where p.is_ok IN ('2', '3')
AND I.is_delete = 0
ORDER BY p.check_time desc
limit 0,5
</select>
SELECT p.id,
I.point_no as code,
IF(p.is_ok = '2', CONCAT(I.name, ' 不合格'), CONCAT(I.name, ' 漏检')) as label,
p.point_id,
'patrol' as type,
p.check_time as changeDate
FROM p_check p
left join p_point I ON I.id = p.point_id
where p.is_ok IN ('2', '3')
AND I.is_delete = 0
ORDER BY p.check_time desc limit 0,5
</select>
<select id="getFireAlarmTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
ala.id,
ala.equipment_specific_id AS pointId,
'monitorEquipment' AS type,
spe.`code`,
ala.type AS alarmType,
ala.equipment_specific_index_name,
CONCAT(
ala.equipment_specific_index_name,
'(',
ala.equipment_specific_name,
')',
IF (
(
ISNULL(ws.full_name)
AND ISNULL(sd.description)
),
'',
CONCAT(
'【',
IFNULL(ws.full_name, ''),
' ',
IFNULL(sd.description, ''),
'】'
)
)
) AS label,
ala.update_date AS changeDate
FROM
wl_equipment_specific_alarm AS ala
LEFT JOIN wl_equipment_specific AS spe ON ala.equipment_specific_id = spe.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = spe.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
WHERE
ala.`status` = 1
AND (
ala.type = 'FIREALARM'
)
ORDER BY
ala.update_date DESC
LIMIT 0,5
</select>
SELECT ala.id,
ala.equipment_specific_id AS pointId,
'monitorEquipment' AS type,
spe.`code`,
ala.type AS alarmType,
ala.equipment_specific_index_name,
CONCAT(
ala.equipment_specific_index_name,
'(',
ala.equipment_specific_name,
')',
IF(
(
ISNULL(ws.full_name)
AND ISNULL(sd.description)
),
'',
CONCAT(
'【',
IFNULL(ws.full_name, ''),
' ',
IFNULL(sd.description, ''),
'】'
)
)
) AS label,
ala.update_date AS changeDate
FROM wl_equipment_specific_alarm AS ala
LEFT JOIN wl_equipment_specific AS spe ON ala.equipment_specific_id = spe.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = spe.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
WHERE ala.`status` = 1
AND (
ala.type = 'FIREALARM'
)
ORDER BY ala.update_date DESC LIMIT 0,5
</select>
<select id="getEquipStatusTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
wlesi.id,
wlesi.`value` `status`,
wles.code,
wlesi.update_date changeDate,
CONCAT(ed.NAME, ' ', wlei.NAME,IF((ISNULL(ws.full_name) AND ISNULL(sd.description)),'',CONCAT(
'【',
IFNULL(ws.full_name, ''),
' ',
IFNULL(sd.description, ''),
'】'
))) label
FROM
wl_equipment_specific_index wlesi
LEFT JOIN wl_equipment_index wlei ON wlesi.equipment_index_id = wlei.id
LEFT JOIN wl_equipment_specific wles ON wlesi.equipment_specific_id = wles.id
LEFT JOIN wl_equipment_detail ed ON ed.id = wles.equipment_detail_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = wles.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
WHERE
wlei.is_alarm = false
ORDER BY
wlesi.update_date DESC
LIMIT 0,5
</select>
<select id="initViewErrorNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
select * from (
select
R.id,R.name,R.code,R.ue4_location,R.ue4_rotation,
'riskSource' as type,
rl.level,
CONCAT('level_',rl.level) as level_str,
R.id as risk_source_id,
r.flicker_frequency as frequency,
true as 'showInfo',
r.rpn as title
from f_risk_source R ,f_risk_level rl
where
r.is_region <![CDATA[<>]]> 'TRUE'
AND R.status = 'ANOMALY'
AND rl.id = r.risk_level_id
AND (R.org_code = #{orgCode} OR R.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
p.id,p.name,p.point_no as code,p.ue4_location,p.ue4_rotation,
'patrol' as type,
p.status as level,
CONCAT('level_',p.status) as level_str,
p.risk_source_id,
0 as frequency,
case p.status
when '0'
then false
else
true
end as `showInfo`,
case p.status
when '0'
then '未计划'
when '2'
then '不合格'
when '3'
then '漏检'
end as title
from p_point p
where status in ('0','2','3')
AND (p.org_code = #{orgCode} OR p.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
distinct e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,
'impEquipment' as type,
0 as level,
'level_0' as kevek_str,
e.risk_source_id,
0 as frequency,
false as 'showInfo',
'' as title
from
f_equipment e
left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
left join wl_equipment_specific fe ON efe.fire_equipment_id = fe.id
where (e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%'))
) tmp
where 1=1
<if test="riskSourceId != null">
AND FIND_IN_SET(tmp.risk_source_id,queryRiskSourceChildrenIds(#{riskSourceId}))
</if>
<if test="type != null">
AND tmp.type = #{type}
</if>
</select>
SELECT *
from (
SELECT wlesi.id,
wlesi.`value` `status`,
wles.code,
wlesi.update_date changeDate,
CONCAT(ed.NAME, ' ', wlei.NAME,
IF((ISNULL(ws.full_name) AND ISNULL(sd.description)), '', CONCAT(
'【',
IFNULL(ws.full_name, ''),
' ',
IFNULL(sd.description, ''),
'】'
))) label
FROM wl_equipment_specific_index wlesi
LEFT JOIN wl_equipment_index wlei ON wlesi.equipment_index_id = wlei.id
LEFT JOIN wl_equipment_specific wles ON wlesi.equipment_specific_id = wles.id
LEFT JOIN wl_equipment_detail ed ON ed.id = wles.equipment_detail_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = wles.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
WHERE wlei.is_alarm = false
and wlei.type_code in
('Action', 'Reset', 'FeedBack', 'StartStop', 'Tripping', 'Control', 'Normal', 'WYStartStop')
ORDER BY wlesi.update_date DESC LIMIT 0,5
) a
where a.label is not null
</select>
<select id="retrieveAllCount" resultType="long">
SELECT
count(1)
FROM
(
SELECT
*
FROM
(
SELECT
r.`code`,
r.`name`,
r.org_code AS orgCode,
'riskSource' AS typeCode,
r.id AS riskSourceId
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
WHERE
r.is_region = 'FALSE'
<if test = "dataLevel != null and dataLevel != ''" >
AND rl. level = #{dataLevel}
</if>
UNION ALL
SELECT
p.point_no AS code,
p.`name`,
p.org_code AS orgCode,
'patrol' AS typeCode,
p.risk_source_id AS riskSourceId
FROM
p_point p
LEFT JOIN f_risk_source r ON r.id = p.risk_source_id
WHERE
is_delete = FALSE
UNION ALL
SELECT
e.`code`,
e.`name`,
e.org_code AS orgCode,
'impEquipment' AS typeCode,
e.risk_source_id AS riskSourceId
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
m.`code` AS code,
m.`name`,
m.org_code AS orgCode,
'monitorEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific m
LEFT JOIN wl_stock_detail AS sto ON sto.equipment_specific_id = m.id
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(m.equipment_code, 1, 4) = '9204'
GROUP BY
m.`code`
UNION ALL
SELECT
vi.`code`,
vi.`name`,
vi.org_code AS orgCode,
'video' AS typeCode,
vis.source_id AS riskSourceId
FROM
wl_video AS vi
LEFT JOIN wl_video_source AS vis ON vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
GROUP BY
vi.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
str.source_id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
WHERE
substr(cat.`code`, 1, 4) = '3105'
AND str.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN ('pool', 'r_pool')
GROUP BY
a.instance_id
) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION ALL
SELECT
car.car_num AS code,
car.`name`,
car.org_code AS orgCode,
'fireEquipment' AS typeCode,
'' as riskSourceId
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(cat.`code`, 1, 4) = '3104'
AND risk.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN (
'fireFoamRoom',
'r_fireFoamRoom'
)
GROUP BY
a.instance_id
) s,
f_risk_source r
WHERE
s.instanceId = r.source_id
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN ('fireRoom', 'r_fireRoom')
GROUP BY
a.instance_id
) s,
f_risk_source r
WHERE
s.instanceId = r.source_id
) AS tmp
<where>
<if test="inputText!=null and inputText != ''">
(
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
)
</if>
<if test="type!=null and type!=''">
AND tmp.typeCode = #{type}
</if>
<if test="riskSourceId != null and riskSourceId!=''">
AND tmp.riskSourceId = #{riskSourceId}
</if>
</where>
) t
</select>
<select id="retrieveAll" resultType="java.util.HashMap">
select *,'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,'{ "x": 1, "y": 1, "z": 1 }' scaleDTO
from (select concat('riskSource-',r.id) as id,concat(r.id) as originId,r.name,r.code,r.ue4_location as ue4Location,r.ue4_rotation as ue4Rotation ,'riskSource' as type,r.org_code as orgCode,
rl.level as level,rl.name as levelStr,r.is_indoor as isIndoor,'风险点' as typeName,'riskSource' as typeCode,
CASE
WHEN (
ISNULL(r.position3d) || LENGTH(trim(r.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(r.position3d, ',', 1),
',"y":',
substring_index(
substring_index(r.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(r.position3d, ',', - 1),
'}'
)
END positionDTO,
r.name as label,
r.name as protectObjName,
'' as routeName,
'' as person,
r.rpn as title,
CONCAT('riskSource-',r.id) as `key`,
r.id as riskSourceId,
'' as room
from f_risk_source r
left join f_risk_level rl ON rl.id = r.risk_level_id
where r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl.level = #{dataLevel}
</if>
UNION all
select concat('patrol-',p.id) as id,concat(p.id) as originId,p.name,p.point_no as code,p.ue4_location as ue4Location,p.ue4_rotation as ue4Rotation ,'patrol' as type,p.org_code as orgCode,
p.status as level,CONCAT('level_',p.status) as levelStr,p.is_indoor as isIndoor,'巡检点' as typeName,'patrol' as typeCode,
CASE
WHEN (
ISNULL(p.coordinates) || LENGTH(trim(p.coordinates)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(p.coordinates, ',', 1),
',"y":',
substring_index(
substring_index(p.coordinates, ',', - 2),
',',
1
),
',"z":',
substring_index(p.coordinates, ',', - 1),
'}'
)
END positionDTO,
p.name as label,
p.name as protectObjName,
p.route_name as routeName,
p.charge_person_id as person,
case
when p.status = '0' then '未执行'
when p.status = '1' then '合格'
when p.status = '2' then '不合格'
when p.status = '3' then '漏检'
end as title,
concat('patrol-',p.id) as `key`,
p.risk_source_id as riskSourceId,
r.name as room
from p_point p
left join f_risk_source r on r.id = p.risk_source_id
WHERE is_delete = FALSE
UNION all
select concat('impEquipment-',e.id) as id,concat(e.id) as originId,e.name,e.code,e.ue4_location as ue4Location,e.ue4_rotation as ue4Rotation ,'impEquipment' as type,e.org_code as orgCode,
0 as level,'level_0' as levelStr,e.is_indoor as isIndoor,'重点设备' as typeName,'impEquipment' as typeCode,
CASE
WHEN (
ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(e.position3d, ',', 1),
',"y":',
substring_index(
substring_index(e.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(e.position3d, ',', - 1),
'}'
)
END positionDTO,
e.name as label,
e.name as protectObjName,
'' as routeName,
'' as person,
e.name as title,
concat('impEquipment-',e.id) as `key`,
e.risk_source_id as riskSourceId,
r.name as room
from f_equipment e
left join f_risk_source r on r.id = e.risk_source_id
UNION all
select concat('monitorEquipment-',m.id) as id,concat(m.id) as originId,det.name,m.code as code,'' as ue4Location,'' as ue4Rotation ,'monitorEquipment' as type,m.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'探测器' as typeName,'monitorEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
(select
group_concat(fet.`name`)
from f_equipment_fire_equipment as fefe
left join f_equipment as fet on fet.id = fefe.equipment_id
where fefe.fire_equipment_id = m.id
) as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('monitorEquipment-',m.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific m
left join wl_equipment_detail as det on m.equipment_detail_id = det.id
left join wl_stock_detail as sto on sto.qr_code = m.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(m.equipment_code ,1,4) = '9204'
group By m.code
UNION all
select concat('video-',vi.id) as id,concat(vi.id) as originId,vi.name,vi.code,null as ue4Location,null as ue4Rotation ,'video' as type,vi.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'摄像头' as typeName,'video' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
vi.name as label,
ws.name as protectObjName,
'' as routeName,
'' as person,
vi.name as title,
concat('video-',vi.id) as `key`,
vis.source_id as riskSourceId,
CONCAT(ws.full_name,vi.address) AS room
from wl_video as vi
left join wl_video_source as vis on vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
group by vi.id
UNION all
select concat('hydrant-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as ue4Location,null as ue4Rotation ,'hydrant' as type,spe.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防栓' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null ) || LENGTH(trim(null )) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('hydrant-',spe.id) as `key`,
str.source_id as riskSourceId,
str.full_name as room
from
wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
where substr(cat.code ,1,4)= '3105'
UNION all
select
concat('pool-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'pool' as type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防水池' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('pool-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('pool','r_pool')
GROUP BY
a.instance_id) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION all
select concat('fireCar-',car.id) as id,concat(car.id) as originId,car.name,car.car_num as code,null as ue4Location,null as ue4Rotation, 'fireCar' as type,car.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防车' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
car.name as label,
car.name as protectObjName,
'' as routeName,
'' as person,
car.name as title,
concat('fireCar-',car.id) as `key`,
#{riskSourceId} as riskSourceId,
'' as room
from wl_car as car
left join wl_equipment as equ on car.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
UNION all
select concat('extinguisher-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as ue4Location,null as ue4Rotation,'extinguisher' as type,spe.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'灭火器' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('extinguisher-',spe.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(cat.code ,1,4) = '3104'
UNION all
select
concat('fireChamber-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireChamber' as type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'泡沫间' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('fireChamber-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('fireFoamRoom','r_fireFoamRoom')
GROUP BY
a.instance_id) s,
f_risk_source r
where s.instanceId = r.source_id
UNION all
select
concat('fireFoamRoom-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireFoamRoom' as type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防室' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('fireFoamRoom-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
<select id="initViewErrorNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
select * from (
select
R.id,R.name,R.code,R.ue4_location,R.ue4_rotation,
'riskSource' as type,
rl.level,
CONCAT('level_',rl.level) as level_str,
R.id as risk_source_id,
r.flicker_frequency as frequency,
true as 'showInfo',
r.rpn as title
from f_risk_source R ,f_risk_level rl
where
r.is_region <![CDATA[<>]]> 'TRUE'
AND R.status = 'ANOMALY'
AND rl.id = r.risk_level_id
AND (R.org_code = #{orgCode} OR R.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
p.id,p.name,p.point_no as code,p.ue4_location,p.ue4_rotation,
'patrol' as type,
p.status as level,
CONCAT('level_',p.status) as level_str,
p.risk_source_id,
0 as frequency,
case p.status
when '0'
then false
else
true
end as `showInfo`,
case p.status
when '0'
then '未计划'
when '2'
then '不合格'
when '3'
then '漏检'
end as title
from p_point p
where status in ('0','2','3')
AND (p.org_code = #{orgCode} OR p.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
distinct e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,
'impEquipment' as type,
0 as level,
'level_0' as kevek_str,
e.risk_source_id,
0 as frequency,
false as 'showInfo',
'' as title
from
f_equipment e
left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
left join wl_equipment_specific fe ON efe.fire_equipment_id = fe.id
where (e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%'))
) tmp
where 1=1
<if test="riskSourceId != null">
AND FIND_IN_SET(tmp.risk_source_id,queryRiskSourceChildrenIds(#{riskSourceId}))
</if>
<if test="type != null">
AND tmp.type = #{type}
</if>
</select>
<select id="retrieveAllCount" resultType="long">
SELECT
count(1)
FROM
(
SELECT
*
FROM
(
SELECT
r.`code`,
r.`name`,
r.org_code AS orgCode,
'riskSource' AS typeCode,
r.id AS riskSourceId
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
WHERE
r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl. level = #{dataLevel}
</if>
UNION ALL
SELECT
p.point_no AS code,
p.`name`,
p.org_code AS orgCode,
'patrol' AS typeCode,
p.risk_source_id AS riskSourceId
FROM
p_point p
LEFT JOIN f_risk_source r ON r.id = p.risk_source_id
WHERE
is_delete = FALSE
UNION ALL
SELECT
e.`code`,
e.`name`,
e.org_code AS orgCode,
'impEquipment' AS typeCode,
e.risk_source_id AS riskSourceId
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
m.`code` AS code,
m.`name`,
m.org_code AS orgCode,
'monitorEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific m
LEFT JOIN wl_stock_detail AS sto ON sto.equipment_specific_id = m.id
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(m.equipment_code, 1, 4) = '9204'
GROUP BY
m.`code`
UNION ALL
SELECT
vi.`code`,
vi.`name`,
vi.org_code AS orgCode,
'video' AS typeCode,
vis.source_id AS riskSourceId
FROM
wl_video AS vi
LEFT JOIN wl_video_source AS vis ON vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
GROUP BY
vi.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
str.source_id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
WHERE
substr(cat.`code`, 1, 4) = '3105'
AND str.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN ('pool', 'r_pool')
GROUP BY
a.instance_id
) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION ALL
SELECT
car.car_num AS code,
car.`name`,
car.org_code AS orgCode,
'fireEquipment' AS typeCode,
'' as riskSourceId
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(cat.`code`, 1, 4) = '3104'
AND risk.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN (
'fireFoamRoom',
'r_fireFoamRoom'
)
GROUP BY
a.instance_id
) s,
f_risk_source r
WHERE
s.instanceId = r.source_id
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN ('fireRoom', 'r_fireRoom')
GROUP BY
a.instance_id
) s,
f_risk_source r
WHERE
s.instanceId = r.source_id
) AS tmp
<where>
<if test="inputText!=null and inputText != ''">
(
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
)
</if>
<if test="type!=null and type!=''">
AND tmp.typeCode = #{type}
</if>
<if test="riskSourceId != null and riskSourceId!=''">
AND tmp.riskSourceId = #{riskSourceId}
</if>
</where>
) t
</select>
<select id="retrieveAll" resultType="java.util.HashMap">
select *,'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,'{ "x": 1, "y": 1, "z": 1 }' scaleDTO
from (select concat('riskSource-',r.id) as id,concat(r.id) as originId,r.name,r.code,r.ue4_location as
ue4Location,r.ue4_rotation as ue4Rotation ,'riskSource' as type,r.org_code as orgCode,
rl.level as level,rl.name as levelStr,r.is_indoor as isIndoor,'风险点' as typeName,'riskSource' as typeCode,
CASE
WHEN (
ISNULL(r.position3d) || LENGTH(trim(r.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(r.position3d, ',', 1),
',"y":',
substring_index(
substring_index(r.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(r.position3d, ',', - 1),
'}'
)
END positionDTO,
r.name as label,
r.name as protectObjName,
'' as routeName,
'' as person,
r.rpn as title,
CONCAT('riskSource-',r.id) as `key`,
r.id as riskSourceId,
'' as room
from f_risk_source r
left join f_risk_level rl ON rl.id = r.risk_level_id
where r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl.level = #{dataLevel}
</if>
UNION all
select concat('patrol-',p.id) as id,concat(p.id) as originId,p.name,p.point_no as code,p.ue4_location as
ue4Location,p.ue4_rotation as ue4Rotation ,'patrol' as type,p.org_code as orgCode,
p.status as level,CONCAT('level_',p.status) as levelStr,p.is_indoor as isIndoor,'巡检点' as typeName,'patrol' as
typeCode,
CASE
WHEN (
ISNULL(p.coordinates) || LENGTH(trim(p.coordinates)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(p.coordinates, ',', 1),
',"y":',
substring_index(
substring_index(p.coordinates, ',', - 2),
',',
1
),
',"z":',
substring_index(p.coordinates, ',', - 1),
'}'
)
END positionDTO,
p.name as label,
p.name as protectObjName,
p.route_name as routeName,
p.charge_person_id as person,
case
when p.status = '0' then '未执行'
when p.status = '1' then '合格'
when p.status = '2' then '不合格'
when p.status = '3' then '漏检'
end as title,
concat('patrol-',p.id) as `key`,
p.risk_source_id as riskSourceId,
r.name as room
from p_point p
left join f_risk_source r on r.id = p.risk_source_id
WHERE is_delete = FALSE
UNION all
select concat('impEquipment-',e.id) as id,concat(e.id) as originId,e.name,e.code,e.ue4_location as
ue4Location,e.ue4_rotation as ue4Rotation ,'impEquipment' as type,e.org_code as orgCode,
0 as level,'level_0' as levelStr,e.is_indoor as isIndoor,'重点设备' as typeName,'impEquipment' as typeCode,
CASE
WHEN (
ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(e.position3d, ',', 1),
',"y":',
substring_index(
substring_index(e.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(e.position3d, ',', - 1),
'}'
)
END positionDTO,
e.name as label,
e.name as protectObjName,
'' as routeName,
'' as person,
e.name as title,
concat('impEquipment-',e.id) as `key`,
e.risk_source_id as riskSourceId,
r.name as room
from f_equipment e
left join f_risk_source r on r.id = e.risk_source_id
UNION all
select concat('monitorEquipment-',m.id) as id,concat(m.id) as originId,det.name,m.code as code,'' as
ue4Location,'' as ue4Rotation ,'monitorEquipment' as type,m.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'探测器' as typeName,'monitorEquipment' as
typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
(select
group_concat(fet.`name`)
from f_equipment_fire_equipment as fefe
left join f_equipment as fet on fet.id = fefe.equipment_id
where fefe.fire_equipment_id = m.id
) as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('monitorEquipment-',m.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific m
left join wl_equipment_detail as det on m.equipment_detail_id = det.id
left join wl_stock_detail as sto on sto.qr_code = m.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(m.equipment_code ,1,4) = '9204'
group By m.code
UNION all
select concat('video-',vi.id) as id,concat(vi.id) as originId,vi.name,vi.code,null as ue4Location,null as
ue4Rotation ,'video' as type,vi.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'摄像头' as typeName,'video' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
vi.name as label,
ws.name as protectObjName,
'' as routeName,
'' as person,
vi.name as title,
concat('video-',vi.id) as `key`,
vis.source_id as riskSourceId,
CONCAT(ws.full_name,vi.address) AS room
from wl_video as vi
left join wl_video_source as vis on vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
group by vi.id
UNION all
select concat('hydrant-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as
ue4Location,null as ue4Rotation ,'hydrant' as type,spe.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防栓' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null ) || LENGTH(trim(null )) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('hydrant-',spe.id) as `key`,
str.source_id as riskSourceId,
str.full_name as room
from
wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
where substr(cat.code ,1,4)= '3105'
UNION all
select
concat('pool-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'pool' as type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防水池' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('pool-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('pool','r_pool')
GROUP BY
a.instance_id) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION all
select concat('fireCar-',car.id) as id,concat(car.id) as originId,car.name,car.car_num as code,null as
ue4Location,null as ue4Rotation, 'fireCar' as type,car.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防车' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
car.name as label,
car.name as protectObjName,
'' as routeName,
'' as person,
car.name as title,
concat('fireCar-',car.id) as `key`,
#{riskSourceId} as riskSourceId,
'' as room
from wl_car as car
left join wl_equipment as equ on car.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
UNION all
select concat('extinguisher-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as
ue4Location,null as ue4Rotation,'extinguisher' as type,spe.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'灭火器' as typeName,'fireEquipment' as
typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('extinguisher-',spe.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(cat.code ,1,4) = '3104'
UNION all
select
concat('fireChamber-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireChamber' as
type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'泡沫间' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('fireChamber-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('fireFoamRoom','r_fireFoamRoom')
GROUP BY
a.instance_id) s,
f_risk_source r
where s.instanceId = r.source_id
UNION all
select
concat('fireFoamRoom-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireFoamRoom' as
type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防室' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('fireFoamRoom-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('fireRoom','r_fireRoom')
......@@ -1086,52 +1064,52 @@
<select id="retrieve3AllCount" resultType="long">
SELECT count(1) FROM (
SELECT
concat('fireCar-', car.id) AS id,
concat(car.id) AS originId,
car.`name`,
car.car_num AS `code`,
'fireCar' AS type,
car.org_code AS orgCode,
0 AS level,
'level_0' AS levelStr,
'' AS isIndoor,
'消防车' AS typeName,
'fireEquipment' AS typeCode,
car.`name` AS label,
car.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
car.`name` AS title,
concat('fireCar-', car.id) AS `key`,
'' AS riskSourceId,
'' AS room
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
concat('fireCar-', car.id) AS id,
concat(car.id) AS originId,
car.`name`,
car.car_num AS `code`,
'fireCar' AS type,
car.org_code AS orgCode,
0 AS level,
'level_0' AS levelStr,
'' AS isIndoor,
'消防车' AS typeName,
'fireEquipment' AS typeCode,
car.`name` AS label,
car.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
car.`name` AS title,
concat('fireCar-', car.id) AS `key`,
'' AS riskSourceId,
'' AS room
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
SELECT
concat('riskSource-', r.id) AS id,
concat(r.id) AS originId,
r.`name`,
r.`code`,
'riskSource' AS type,
r.org_code AS orgCode,
rl.`level` AS level,
rl.`name` AS levelStr,
r.is_indoor AS isIndoor,
'风险点' AS typeName,
'riskSource' AS typeCode,
r.`name` AS label,
r.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
r.rpn AS title,
CONCAT('riskSource-', r.id) AS `key`,
r.id AS riskSourceId,
'' AS room
concat('riskSource-', r.id) AS id,
concat(r.id) AS originId,
r.`name`,
r.`code`,
'riskSource' AS type,
r.org_code AS orgCode,
rl.`level` AS level,
rl.`name` AS levelStr,
r.is_indoor AS isIndoor,
'风险点' AS typeName,
'riskSource' AS typeCode,
r.`name` AS label,
r.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
r.rpn AS title,
CONCAT('riskSource-', r.id) AS `key`,
r.id AS riskSourceId,
'' AS room
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
......@@ -1142,64 +1120,64 @@
</if>
UNION ALL
SELECT
concat('video-', vi.id) AS id,
concat(vi.id) AS originId,
vi.`name`,
vi.`code`,
'video' AS type,
vi.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'摄像头' AS typeName,
'video' AS typeCode,
vi.`name` AS label,
vi.`name` AS protectObjName,
'' AS routeName,
vi.belongAreaId AS areaId,
'' AS person,
vi.`name` AS title,
concat('video-', vi.id) AS `key`,
'' AS riskSourceId,
vi.address AS room
FROM
wl_video AS vi
concat('video-', vi.id) AS id,
concat(vi.id) AS originId,
vi.`name`,
vi.`code`,
'video' AS type,
vi.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'摄像头' AS typeName,
'video' AS typeCode,
vi.`name` AS label,
vi.`name` AS protectObjName,
'' AS routeName,
vi.belongAreaId AS areaId,
'' AS person,
vi.`name` AS title,
concat('video-', vi.id) AS `key`,
'' AS riskSourceId,
vi.address AS room
FROM
wl_video AS vi
<where>
<if test="areaId != null and areaId !=0">
vi.belongAreaId = #{areaId}
vi.belongAreaId = #{areaId}
</if>
</where>
UNION ALL
SELECT
concat('patrol-', p.id) AS id,
concat(p.id) AS originId,
p.`name`,
p.point_no AS CODE,
'patrol' AS type,
p.org_code AS orgCode,
p.`status` AS level,
CONCAT('level_', p.STATUS) AS levelStr,
p.is_indoor AS isIndoor,
'巡检点' AS typeName,
'patrol' AS typeCode,
p.`name` AS label,
p.`name` AS protectObjName,
p.route_name AS routeName,
p.area_id AS areaId,
p.charge_person_id AS person,
CASE
WHEN p.`status` = '0' THEN
'未执行'
WHEN p.`status` = '1' THEN
'合格'
WHEN p.`status` = '2' THEN
'不合格'
WHEN p.`status` = '3' THEN
'漏检'
END AS title,
concat('patrol-', p.id) AS `key`,
p.risk_source_id AS riskSourceId,
r.full_name AS room
concat('patrol-', p.id) AS id,
concat(p.id) AS originId,
p.`name`,
p.point_no AS CODE,
'patrol' AS type,
p.org_code AS orgCode,
p.`status` AS level,
CONCAT('level_', p.STATUS) AS levelStr,
p.is_indoor AS isIndoor,
'巡检点' AS typeName,
'patrol' AS typeCode,
p.`name` AS label,
p.`name` AS protectObjName,
p.route_name AS routeName,
p.area_id AS areaId,
p.charge_person_id AS person,
CASE
WHEN p.`status` = '0' THEN
'未执行'
WHEN p.`status` = '1' THEN
'合格'
WHEN p.`status` = '2' THEN
'不合格'
WHEN p.`status` = '3' THEN
'漏检'
END AS title,
concat('patrol-', p.id) AS `key`,
p.risk_source_id AS riskSourceId,
r.full_name AS room
FROM
p_point p
LEFT JOIN wl_warehouse_structure r ON r.id = p.risk_source_id
......@@ -1210,52 +1188,52 @@
</if>
</where>
UNION ALL
SELECT
concat( 'impEquipment-', e.id ) AS id,
concat( e.id ) AS originId,
e.NAME,
e.CODE,
'impEquipment' AS type,
e.org_code AS orgCode,
0 AS LEVEL,
'level_0' AS levelStr,
e.is_indoor AS isIndoor,
'重点设备' AS typeName,
'impEquipment' AS typeCode,
e.NAME AS label,
e.NAME AS protectObjName,
'' AS routeName,
NULL AS areaId,
'' AS person,
e.NAME AS title,
concat( 'impEquipment-', e.id ) AS `key`,
e.risk_source_id AS riskSourceId,
r.NAME AS room
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
concat('fireEquipment-', m.id) AS id,
concat(m.id) AS originId,
det.`name`,
m.`code` AS `code`,
'fireEquipment' AS type,
m.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'消防设备' AS typeName,
'fireEquipment' AS typeCode,
det.`name` AS label,
det.`name` AS protectObjName,
'' AS routeName,
m.area_id AS areaId,
'' AS person,
det.`name` AS title,
concat('fireEquipment-', m.id) AS `key`,
risk.id AS riskSourceId,
str.full_name AS room
concat( 'impEquipment-', e.id ) AS id,
concat( e.id ) AS originId,
e.NAME,
e.CODE,
'impEquipment' AS type,
e.org_code AS orgCode,
0 AS LEVEL,
'level_0' AS levelStr,
e.is_indoor AS isIndoor,
'重点设备' AS typeName,
'impEquipment' AS typeCode,
e.NAME AS label,
e.NAME AS protectObjName,
'' AS routeName,
NULL AS areaId,
'' AS person,
e.NAME AS title,
concat( 'impEquipment-', e.id ) AS `key`,
e.risk_source_id AS riskSourceId,
r.NAME AS room
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
concat('fireEquipment-', m.id) AS id,
concat(m.id) AS originId,
det.`name`,
m.`code` AS `code`,
'fireEquipment' AS type,
m.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'消防设备' AS typeName,
'fireEquipment' AS typeCode,
det.`name` AS label,
det.`name` AS protectObjName,
'' AS routeName,
m.area_id AS areaId,
'' AS person,
det.`name` AS title,
concat('fireEquipment-', m.id) AS `key`,
risk.id AS riskSourceId,
str.full_name AS room
FROM
wl_equipment_specific m
LEFT JOIN wl_equipment_detail AS det ON m.equipment_detail_id = det.id
......@@ -1295,52 +1273,52 @@
<select id="retrieve3All" resultType="java.util.HashMap">
SELECT * FROM (
SELECT
concat('fireCar-', car.id) AS id,
concat(car.id) AS originId,
car.`name`,
car.car_num AS `code`,
'fireCar' AS type,
car.org_code AS orgCode,
0 AS level,
'level_0' AS levelStr,
'' AS isIndoor,
'消防车' AS typeName,
'fireEquipment' AS typeCode,
car.`name` AS label,
car.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
car.`name` AS title,
concat('fireCar-', car.id) AS `key`,
'' AS riskSourceId,
'' AS room
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
concat('fireCar-', car.id) AS id,
concat(car.id) AS originId,
car.`name`,
car.car_num AS `code`,
'fireCar' AS type,
car.org_code AS orgCode,
0 AS level,
'level_0' AS levelStr,
'' AS isIndoor,
'消防车' AS typeName,
'fireEquipment' AS typeCode,
car.`name` AS label,
car.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
car.`name` AS title,
concat('fireCar-', car.id) AS `key`,
'' AS riskSourceId,
'' AS room
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
SELECT
concat('riskSource-', r.id) AS id,
concat(r.id) AS originId,
r.`name`,
r.`code`,
'riskSource' AS type,
r.org_code AS orgCode,
rl.`level` AS level,
rl.`name` AS levelStr,
r.is_indoor AS isIndoor,
'风险点' AS typeName,
'riskSource' AS typeCode,
r.`name` AS label,
r.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
r.rpn AS title,
CONCAT('riskSource-', r.id) AS `key`,
r.id AS riskSourceId,
'' AS room
concat('riskSource-', r.id) AS id,
concat(r.id) AS originId,
r.`name`,
r.`code`,
'riskSource' AS type,
r.org_code AS orgCode,
rl.`level` AS level,
rl.`name` AS levelStr,
r.is_indoor AS isIndoor,
'风险点' AS typeName,
'riskSource' AS typeCode,
r.`name` AS label,
r.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
r.rpn AS title,
CONCAT('riskSource-', r.id) AS `key`,
r.id AS riskSourceId,
'' AS room
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
......@@ -1351,64 +1329,64 @@
</if>
UNION ALL
SELECT
concat('video-', vi.id) AS id,
concat(vi.id) AS originId,
vi.`name`,
vi.`code`,
'video' AS type,
vi.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'摄像头' AS typeName,
'video' AS typeCode,
vi.`name` AS label,
vi.`name` AS protectObjName,
'' AS routeName,
vi.belongAreaId AS areaId,
'' AS person,
vi.`name` AS title,
concat('video-', vi.id) AS `key`,
'' AS riskSourceId,
vi.address AS room
FROM
wl_video AS vi
concat('video-', vi.id) AS id,
concat(vi.id) AS originId,
vi.`name`,
vi.`code`,
'video' AS type,
vi.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'摄像头' AS typeName,
'video' AS typeCode,
vi.`name` AS label,
vi.`name` AS protectObjName,
'' AS routeName,
vi.belongAreaId AS areaId,
'' AS person,
vi.`name` AS title,
concat('video-', vi.id) AS `key`,
'' AS riskSourceId,
vi.address AS room
FROM
wl_video AS vi
<where>
<if test="areaId != null and areaId !=0">
vi.belongAreaId = #{areaId}
vi.belongAreaId = #{areaId}
</if>
</where>
UNION ALL
SELECT
concat('patrol-', p.id) AS id,
concat(p.id) AS originId,
p.`name`,
p.point_no AS CODE,
'patrol' AS type,
p.org_code AS orgCode,
p.`status` AS level,
CONCAT('level_', p.STATUS) AS levelStr,
p.is_indoor AS isIndoor,
'巡检点' AS typeName,
'patrol' AS typeCode,
p.`name` AS label,
p.`name` AS protectObjName,
p.route_name AS routeName,
p.area_id AS areaId,
p.charge_person_id AS person,
CASE
WHEN p.`status` = '0' THEN
'未执行'
WHEN p.`status` = '1' THEN
'合格'
WHEN p.`status` = '2' THEN
'不合格'
WHEN p.`status` = '3' THEN
'漏检'
END AS title,
concat('patrol-', p.id) AS `key`,
p.risk_source_id AS riskSourceId,
r.full_name AS room
concat('patrol-', p.id) AS id,
concat(p.id) AS originId,
p.`name`,
p.point_no AS CODE,
'patrol' AS type,
p.org_code AS orgCode,
p.`status` AS level,
CONCAT('level_', p.STATUS) AS levelStr,
p.is_indoor AS isIndoor,
'巡检点' AS typeName,
'patrol' AS typeCode,
p.`name` AS label,
p.`name` AS protectObjName,
p.route_name AS routeName,
p.area_id AS areaId,
p.charge_person_id AS person,
CASE
WHEN p.`status` = '0' THEN
'未执行'
WHEN p.`status` = '1' THEN
'合格'
WHEN p.`status` = '2' THEN
'不合格'
WHEN p.`status` = '3' THEN
'漏检'
END AS title,
concat('patrol-', p.id) AS `key`,
p.risk_source_id AS riskSourceId,
r.full_name AS room
FROM
p_point p
LEFT JOIN wl_warehouse_structure r ON r.id = p.risk_source_id
......@@ -1418,53 +1396,53 @@
AND p.area_id = #{areaId}
</if>
</where>
UNION all
SELECT
concat( 'impEquipment-', e.id ) AS id,
concat( e.id ) AS originId,
e.NAME,
e.CODE,
'impEquipment' AS type,
e.org_code AS orgCode,
0 AS LEVEL,
'level_0' AS levelStr,
e.is_indoor AS isIndoor,
'重点设备' AS typeName,
'impEquipment' AS typeCode,
e.NAME AS label,
e.NAME AS protectObjName,
'' AS routeName,
NULL AS areaId,
'' AS person,
e.NAME AS title,
concat( 'impEquipment-', e.id ) AS `key`,
e.risk_source_id AS riskSourceId,
r.NAME AS room
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION all
SELECT
concat( 'impEquipment-', e.id ) AS id,
concat( e.id ) AS originId,
e.NAME,
e.CODE,
'impEquipment' AS type,
e.org_code AS orgCode,
0 AS LEVEL,
'level_0' AS levelStr,
e.is_indoor AS isIndoor,
'重点设备' AS typeName,
'impEquipment' AS typeCode,
e.NAME AS label,
e.NAME AS protectObjName,
'' AS routeName,
NULL AS areaId,
'' AS person,
e.NAME AS title,
concat( 'impEquipment-', e.id ) AS `key`,
e.risk_source_id AS riskSourceId,
r.NAME AS room
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
concat('fireEquipment-', m.id) AS id,
concat(m.id) AS originId,
det.`name`,
m.`code` AS `code`,
'fireEquipment' AS type,
m.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'消防设备' AS typeName,
'fireEquipment' AS typeCode,
det.`name` AS label,
det.`name` AS protectObjName,
'' AS routeName,
m.area_id AS areaId,
'' AS person,
det.`name` AS title,
concat('fireEquipment-', m.id) AS `key`,
risk.id AS riskSourceId,
str.full_name AS room
concat('fireEquipment-', m.id) AS id,
concat(m.id) AS originId,
det.`name`,
m.`code` AS `code`,
'fireEquipment' AS type,
m.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'消防设备' AS typeName,
'fireEquipment' AS typeCode,
det.`name` AS label,
det.`name` AS protectObjName,
'' AS routeName,
m.area_id AS areaId,
'' AS person,
det.`name` AS title,
concat('fireEquipment-', m.id) AS `key`,
risk.id AS riskSourceId,
str.full_name AS room
FROM
wl_equipment_specific m
LEFT JOIN wl_equipment_detail AS det ON m.equipment_detail_id = det.id
......@@ -1503,38 +1481,33 @@
LIMIT ${start},${length}
</select>
<select id="getPlanAlarmInfo" resultType="com.yeejoin.amos.fas.business.bo.FirePlanAlarmBo">
SELECT
'4' stationId,
cod.batch_No,
cod.equipment_Name AS deviceName,
fe.`code` AS deviceId,
cod.equipment_Id,
wes.`code` AS FiredeviceId,
cod.fire_Equipment_Id,
cod.fire_Equipment_Name AS FiredeviceName,
wesa.create_date AS warningTime,
IF (
ISNULL(wesa.id),
'',
CONCAT(
'位于',
wesa.location,
' ',
wes.`name`,
'发生',
wesa.equipment_specific_index_name
)
) AS warningInfo
FROM
`contingency_original_data` cod
LEFT JOIN f_equipment fe ON fe.id = cod.equipment_Id
LEFT JOIN wl_equipment_specific wes ON wes.id = cod.fire_Equipment_Id
LEFT JOIN wl_equipment_specific_alarm wesa ON wesa.equipment_specific_id = wes.id
WHERE
cod.batch_No = #{batchNo}
ORDER BY
wesa.create_date DESC
LIMIT 1
SELECT '4' stationId,
cod.batch_No,
cod.equipment_Name AS deviceName,
fe.`code` AS deviceId,
cod.equipment_Id,
wes.`code` AS FiredeviceId,
cod.fire_Equipment_Id,
cod.fire_Equipment_Name AS FiredeviceName,
wesa.create_date AS warningTime,
IF(
ISNULL(wesa.id),
'',
CONCAT(
'位于',
wesa.location,
' ',
wes.`name`,
'发生',
wesa.equipment_specific_index_name
)
) AS warningInfo
FROM `contingency_original_data` cod
LEFT JOIN f_equipment fe ON fe.id = cod.equipment_Id
LEFT JOIN wl_equipment_specific wes ON wes.id = cod.fire_Equipment_Id
LEFT JOIN wl_equipment_specific_alarm wesa ON wesa.equipment_specific_id = wes.id
WHERE cod.batch_No = #{batchNo}
ORDER BY wesa.create_date DESC LIMIT 1
</select>
</mapper>
\ No newline at end of file
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