Commit 7d988369 authored by suhuiguang's avatar suhuiguang

1.修改建筑模块替换后,原有数据调整

2.风险与建筑同步关系查询
parent 1e6ac5f6
......@@ -99,23 +99,41 @@
<select id="queryForList" resultType="java.util.Map">
select
bu.id,
bu .name,
SELECT
*
FROM
(
SELECT
a.instance_id AS id,
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,
'1' as type
from
wl_building as bu
left join wl_equipment_category as cat on bu.equipment_code = cat.id
where substr(cat.code ,1,4) = '9301'
FROM
`wl_form_instance` a
WHERE
a.group_code IN ('fireRoom', 'r_fireRoom')
GROUP BY
a.instance_id
) s
<if test="name!=null">
AND fs.name LIKE '%${name}%'
AND s.name LIKE '%${name}%'
</if>
<if test="code!=null">
AND fs.`code` LIKE '%${code}%'
AND s.`code` LIKE '%${code}%'
</if>
<if test="type!=null">
AND fs.`type` LIKE '%${type}%';
AND s.`type` LIKE '%${type}%';
</if>
</select>
......
......@@ -604,14 +604,38 @@
</select>
<select id="findFireStationById" resultType="com.yeejoin.amos.fas.dao.entity.FireStation">
SELECT
wb.`name`,
wb.`code`,
wb.address,
wb.region_id AS riskSourceId
FROM
wl_building wb
WHERE
wb.id = #{id}
SELECT
*
FROM
(
SELECT
a.instance_id AS id,
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
FROM
`wl_form_instance` a
WHERE
a.group_code IN ('pool','r_pool','fireFoamRoom', 'r_fireFoamRoom','fireRoom','r_fireRoom')
GROUP BY
a.instance_id
) s,
f_risk_source r
where s.id = r.source_id and s.id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -528,8 +528,6 @@
rs.id = ${riskSourceId};
</select>
<select id="queryForRiskSourceRpni" resultType="map">
SELECT
rs.`rpni` rpni
......@@ -642,56 +640,56 @@
rf.id = ${factorId}
)
</select>
<select id="queryContingencyWater" resultType="java.util.HashMap">
<!--SELECT
wr.alarm_level,
wr.max_level,
wr.area,
ep.CODE,
wr.`name`,
ep.value
FROM
f_fire_equipment_point ep
INNER JOIN f_water_resource_equipment wre ON wre.fire_equipment_id = ep.fire_equipment_id AND ep.type = 'ANALOGUE'
RIGHT JOIN f_water_resource wr ON wr.id = wre.water_resource_id
LEFT JOIN f_dict d ON d.id = ep.alarm_type AND d.dict_value = 'analogue_water_level'
WHERE wr.type = 2
GROUP BY
wr.alarm_level,
wr.max_level,
wr.area,
wr.`name`-->
SELECT
*
FROM
(
SELECT
building.height AS alarm_level,
building.warn_height AS max_level,
building.area_measure AS area,
building.CODE AS CODE,
building.NAME AS NAME,
3.6 AS
VALUE
*
FROM
wl_building building
LEFT JOIN wl_equipment_category category ON building.equipment_code = category.id
WHERE
category.CODE = 93020000
) wr
(
SELECT
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 = 'height' THEN
a.field_value
END
) AS max_level,
MAX(
CASE
WHEN a.field_name = 'lowWaterHeight' THEN
a.field_value
END
) AS alarm_level,
MAX(
CASE
WHEN a.field_name = 'bottomArea' THEN
a.field_value
END
) AS area,
3.6 AS value
FROM
`wl_form_instance` a
WHERE
a.group_code IN ('pool', 'r_pool')
GROUP BY
a.instance_id
) s
GROUP BY
wr.alarm_level,
wr.max_level,
wr.area,
wr.`name`
s.alarm_level,
s.max_level,
s.area,
s.`name`
</select>
<select id="queryFmeaByPointId" resultType="java.util.HashMap">
SELECT
frf.`name` riskFactors,
......
......@@ -1216,7 +1216,8 @@
</select>
<select id="retrieveAllCount" resultType="long"> select count(1)
<select id="retrieveAllCount" resultType="long">
select count(1)
from (
select r.name,r.code,'riskSource' as typeCode,r.org_code as orgCode, r.id as riskSourceId
from f_risk_source r
......@@ -1259,16 +1260,52 @@
group by vi.id
-- 建筑
UNION all
select
bu.name,
bu.code as code ,
'fireEquipment' as typeCode,
bu.org_code as orgCode,
bu.region_id as risk_source_id
from
wl_building as bu
left join wl_equipment_category as cat on bu.equipment_code = cat.id
where substr(cat.code ,1,4) in('9302','9301','9305')
SELECT
s.`name`,
s.`code`,
'fireEquipment' AS typeCode,
s.orgCode,
r.id AS risk_source_id
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 = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN (
'fireRoom',
'r_fireRoom',
'pool',
'r_pool',
'fireFoamRoom',
'r_fireFoamRoom'
)
GROUP BY
a.instance_id
) s,
f_risk_source r
WHERE
s.instanceId = r.source_id
-- 探测器
UNION all
select
......@@ -1324,7 +1361,6 @@
AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') )
</if>
</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,
......@@ -1516,7 +1552,6 @@
left join f_risk_source as sou on sou.id = vis.source_id
where vis.source_id is not null
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,
......@@ -1558,39 +1593,52 @@
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(cat.code ,1,4)= '3105' and risk.source_id is not null
UNION all
select concat('pool-',bu.id) as id,concat(bu.id) as originId,bu.name,bu.code,null as ue4Location,null as ue4Rotation,'pool' as type,bu.org_code as orgCode,
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,
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,
bu.name as label,
bu.name as protectObjName,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
bu.name as title,
concat('pool-',bu.id) as `key`,
bu.region_id as riskSourceId,
bu.address as room
from wl_building as bu
left join wl_equipment_category as cat on bu.equipment_code = cat.id
where substr(cat.code ,1,4) = 9302
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,
f_risk_source r
where 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,
......@@ -1665,73 +1713,100 @@
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 concat('fireChamber-',bu.id) as id,concat(bu.id) as originId,bu.name,bu.code,null as ue4Location,null as ue4Rotation , 'fireChamber' as type,bu.org_code as orgCode,
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,
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,
bu.name as label,
bu.name as protectObjName,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
bu.name as title,
concat('fireChamber-',bu.id) as `key`,
bu.region_id as riskSourceId,
bu.address as room
from wl_building as bu
left join wl_equipment_category as cat on bu.equipment_code = cat.id
where substr(cat.code ,1,4) = 9305
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-',bu.id) as id,concat(bu.id) as originId,bu.name,bu.code,null as ue4Location,null as ue4Rotation , 'fireFoamRoom' as type,bu.org_code as orgCode,
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,
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,
bu.name as label,
bu.name as protectObjName,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
bu.name as title,
concat('fireFoamRoom-',bu.id) as `key`,
bu.region_id as riskSourceId,
bu.address as room
from wl_building as bu
left join wl_equipment_category as cat on bu.equipment_code = cat.id
where substr(cat.code ,1,4) = '9301'
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')
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 != ''" >
......@@ -1751,7 +1826,7 @@
</if>
</where>
LIMIT ${start},${length}
</select>
</select>
<select id="getAllPointInRegions" resultType="java.util.Map">
select
CONCAT(type,'-',id) as `key`,
......
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