Commit 36087d9e authored by zhengjiawei's avatar zhengjiawei

sql修改

parent 1f95e80a
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import java.math.BigDecimal;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -133,6 +134,10 @@ public class View3dServiceImpl implements IView3dService {
@Autowired
private RemoteSecurityService remoteSecurityService;
@Value("${station.equipment.code}")
private String equipmentCode;
@Override
@Transactional(rollbackFor = Exception.class)
public CommonResponse setPoint3dPosition(List<BindPointBo> pointBoList) {
......
......@@ -76,3 +76,16 @@ file.downLoad.url=http://39.98.246.31:8888/
#站端名称使用全拼
station.name = yinan
#查询装备分类
#消防车:2101
#灭火器:3104
#消火栓:3105
#探测器:8501
#消防小室:9301
#消防水池:9302
#消防泡沫间:9305
#消防视频:xfsp
station.equipment.code=2101,3104,3105,8501,9301,9302,9305,xfsp
......@@ -797,9 +797,8 @@
from
f_equipment e
left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
left join f_fire_equipment fe ON efe.fire_equipment_id = fe.id
where fe.equip_status = 1
AND (e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%'))
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">
......@@ -1233,35 +1232,77 @@
select name,code,'impEquipment' as typeCode,org_code as orgCode, e.risk_source_id as riskSourceId
from f_equipment e
UNION all
select m.name,m.code,'monitorEquipment' as typeCode,m.org_code as orgCode, m.risk_source_id as riskSourceId
from f_fire_equipment m
left join f_equipment_fire_equipment fe on fe.fire_equipment_id = m.id
left join f_equipment f on f.id = fe.equipment_id
where equip_classify = 0
<if test="protectObjName != null and protectObjName != ''">
AND f.name = #{protectObjName}
</if>
UNION all
select name,code,'video' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_equipment where equip_classify = 2
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_water_resource where type = 1
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_water_resource where type = 2
-- 消防车
select
car.name ,
substr(cat.code ,1,4) as code,
'fireEquipment' as typeCode,
car.org_code as orgCode,
#{riskSourceId} 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 name,car_num as code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_car
select
vi.name,
'xfsp' as code,
'video' as typeCode,
vi.org_code as orgCode,
visou.source_id as risk_source_id
from
wl_video as vi
left join wl_video_source as visou on vi.id = visou.video_id
where visou.source_id is not null
group by vi.id
-- 建筑
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_equipment where equip_classify = 3
select
bu.name,
substr(cat.code ,1,4) 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')
-- 探测器
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_station where type = 2
select
det.name,
substr(cat.code ,1,4) as code,
'monitorEquipment' as typeCode,
spe.org_code as orgCode,
str.source_id as risk_source_id
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.id
where substr(cat.code ,1,4) = 8501
<if test="protectObjName != null and protectObjName != ''">
AND f.name = #{protectObjName}
</if>
-- 消火栓 灭火器
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_station where type = 1
select
det.name,
substr(cat.code ,1,4) as code,
'fireEquipment' as typeCode,
spe.org_code as orgCode,
str.source_id as risk_source_id
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.id
where substr(cat.code ,1,4) in (3104,3105)
) as tmp
where 1=1
<if test="inputText!=null and inputText != ''" >
......@@ -1283,7 +1324,7 @@
<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,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,
from (select concat('riskSource-',r.id) as id,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 (
......@@ -1387,264 +1428,289 @@ from (select concat('riskSource-',r.id) as id,r.id as originId,r.name,r.code,r.u
e.risk_source_id as riskSourceId
from f_equipment e
UNION all
select concat('monitorEquipment-',m.id) as id,m.id as originId,m.name,m.code,m.ue4_location as ue4Location,m.ue4_rotation as ue4Rotation ,'monitorEquipment' as type,m.org_code as orgCode,
m.equip_status as level , concat('level_',m.equip_status) as levelStr,m.is_indoor as isIndoor,'探测器' as typeName,'monitorEquipment' as typeCode,
select concat('monitorEquipment-',m.id) as id,m.id as originId,det.name,substr(cat.code ,1,4),'' 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(m.position3d) || LENGTH(trim(m.position3d)) <![CDATA[ <]]> 1
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(m.position3d, ',', 1),
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(m.position3d, ',', - 2),
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(m.position3d, ',', - 1),
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
m.name as label,
det.name as label,
IFNULL(group_concat(f.name),'') as protectObjName,
'' as routeName,
'' as person,
m.name as title,
det.name as title,
concat('monitorEquipment-',m.id) as `key`,
m.risk_source_id as riskSourceId
from f_fire_equipment m
str.source_id as riskSourceId
from wl_equipment_specific m
left join wl_equipment_detail as det on m.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 = m.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.id
left join f_equipment_fire_equipment fe on fe.fire_equipment_id = m.id
left join f_equipment f on f.id = fe.equipment_id
where equip_classify = 0
where substr(cat.code ,1,4) = 8501
group By m.code
<if test="protectObjName != null and protectObjName != ''">
AND f.name = #{protectObjName}
</if>
UNION all
select concat('video-',m.id) as id,m.id as originId,m.name,m.code,m.ue4_location as ue4Location,m.ue4_rotation as ue4Rotation ,'video' as type,m.org_code as orgCode,
m.equip_status as level , concat('level_',m.equip_status) as levelStr,m.is_indoor as isIndoor,'摄像头' as typeName,'video' as typeCode,
select concat('video-',vi.id) as id,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(m.position3d) || LENGTH(trim(m.position3d)) <![CDATA[ <]]> 1
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(m.position3d, ',', 1),
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(m.position3d, ',', - 2),
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(m.position3d, ',', - 1),
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
m.name as label,
f.name as protectObjName,
vi.name as label,
sou.name as protectObjName,
'' as routeName,
'' as person,
m.name as title,
concat('video-',m.id) as `key`,
m.risk_source_id as riskSourceId
from f_fire_equipment m
left join f_equipment_fire_equipment fe on fe.fire_equipment_id = m.id
left join f_equipment f on f.id = fe.equipment_id
where m.equip_classify = 2
vi.name as title,
concat('video-',vi.id) as `key`,
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 f_risk_source as sou on sou.id = vis.source_id
UNION all
select concat('hydrant-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'hydrant' as type,org_code as orgCode,
0 as level , 'level_0' as levelStr,is_indoor as isIndoor,'消防栓' as typeName,'fireEquipment' as typeCode,
select concat('hydrant-',spe.id) as id,spe.id as originId,det.name,substr(cat.code ,1,4) 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(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
ISNULL(null ) || LENGTH(trim(null )) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('hydrant-',id) as `key`,
risk_source_id as riskSourceId
from f_water_resource where type = 1
det.name as title,
concat('hydrant-',spe.id) as `key`,
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.id
where substr(cat.code ,1,4)= 3105
UNION all
select concat('pool-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'pool' as type,org_code as orgCode,
0 as level , 'level_0' as levelStr,is_indoor as isIndoor,'消防水池' as typeName,'fireEquipment' as typeCode,
select concat('pool-',bu.id) as id,bu.id as originId,bu.name,bu.code,null as ue4Location,null as ue4Rotation,'pool' as type,bu.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防水池' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
bu.name as label,
bu.name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('pool-',id) as `key`,
risk_source_id as riskSourceId
from f_water_resource where type = 2
bu.name as title,
concat('pool-',bu.id) as `key`,
bu.region_id as riskSourceId
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
UNION all
select concat('fireCar-',id) as id,id as originId,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation, 'fireCar' as type,org_code as orgCode,
0 as level , 'level_0' as levelStr,is_indoor as isIndoor,'消防车' as typeName,'fireEquipment' as typeCode,
select concat('fireCar-',car.id) as id,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(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
car.name as label,
car.name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('fireCar-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_car
car.name as title,
concat('fireCar-',car.id) as `key`,
#{riskSourceId} 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 concat('fireEquipment-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'fireEquipment' as type,org_code as orgCode,
equip_status as level , concat('level_',equip_status) as levelStr,is_indoor as isIndoor,'灭火器' as typeName,'fireEquipment' as typeCode,
select concat('fireEquipment-',spe.id) as id,spe.id as originId,det.name,substr(cat.code ,1,4) as code,null as ue4Location,null as ue4Rotation,'fireEquipment' 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(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('fireEquipment-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_equipment where equip_classify = 3
det.name as title,
concat('fireEquipment-',spe.id) as `key`,
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.id
where substr(cat.code ,1,4) = 3104
UNION all
select concat('fireChamber-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation , 'fireChamber' as type,org_code as orgCode,
0 as level , 'level_0' as levelStr,is_indoor as isIndoor,'泡沫间' as typeName,'fireEquipment' as typeCode,
select concat('fireChamber-',bu.id) as id,bu.id as originId,bu.name,bu.code,null as ue4Location,null as ue4Rotation , 'fireChamber' as type,bu.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'泡沫间' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
bu.name as label,
bu.name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('fireChamber-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_station where type = 2
bu.name as title,
concat('fireChamber-',bu.id) as `key`,
bu.region_id as riskSourceId
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
UNION all
select concat('fireFoamRoom-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'fireFoamRoom' as type,org_code as orgCode,
0 as level , 'level_0' as levelStr,is_indoor as isIndoor,'消防室' as typeName,'fireEquipment' as typeCode,
select concat('fireFoamRoom-',bu.id) as id,bu.id as originId,bu.name,bu.code,null as ue4Location,null as ue4Rotation , 'fireFoamRoom' as type,bu.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防室' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
bu.name as label,
bu.name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('fireFoamRoom-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_station where type = 1
bu.name as title,
concat('fireFoamRoom-',bu.id) as `key`,
bu.region_id as riskSourceId
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
) as tmp
<where>
<if test="inputText!=null and inputText != ''" >
......
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