Commit ce6ca1a7 authored by zhengjiawei's avatar zhengjiawei

sql

parent 95526117
...@@ -1277,7 +1277,7 @@ ...@@ -1277,7 +1277,7 @@
spe.code as code, spe.code as code,
'monitorEquipment' as typeCode, 'monitorEquipment' as typeCode,
spe.org_code as orgCode, spe.org_code as orgCode,
str.source_id as risk_source_id risk.source_id as risk_source_id
from from
wl_equipment_specific as spe wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
...@@ -1285,6 +1285,7 @@ ...@@ -1285,6 +1285,7 @@
left join wl_equipment_category as cat on equ.category_id = cat.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_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 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) = 8501 where substr(cat.code ,1,4) = 8501
<if test="protectObjName != null and protectObjName != ''"> <if test="protectObjName != null and protectObjName != ''">
AND f.name = #{protectObjName} AND f.name = #{protectObjName}
...@@ -1296,7 +1297,7 @@ ...@@ -1296,7 +1297,7 @@
spe.code as code, spe.code as code,
'fireEquipment' as typeCode, 'fireEquipment' as typeCode,
spe.org_code as orgCode, spe.org_code as orgCode,
str.source_id as risk_source_id risk.source_id as risk_source_id
from from
wl_equipment_specific as spe wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
...@@ -1304,6 +1305,7 @@ ...@@ -1304,6 +1305,7 @@
left join wl_equipment_category as cat on equ.category_id = cat.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_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 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) in (3104,3105) where substr(cat.code ,1,4) in (3104,3105)
) as tmp ) as tmp
where 1=1 where 1=1
...@@ -1326,7 +1328,6 @@ ...@@ -1326,7 +1328,6 @@
</select> </select>
<select id="retrieveAll" resultType="java.util.HashMap"> <select id="retrieveAll" resultType="java.util.HashMap">
select *,'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,'{ "x": 1, "y": 1, "z": 1 }' scaleDTO 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, rl.level as level,rl.name as levelStr,r.is_indoor as isIndoor,'风险点' as typeName,'riskSource' as typeCode,
...@@ -1460,13 +1461,14 @@ ...@@ -1460,13 +1461,14 @@
'' as person, '' as person,
det.name as title, det.name as title,
concat('monitorEquipment-',m.id) as `key`, concat('monitorEquipment-',m.id) as `key`,
str.source_id as riskSourceId risk.source_id as riskSourceId
from wl_equipment_specific m from wl_equipment_specific m
left join wl_equipment_detail as det on m.equipment_detail_id = det.id 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 as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.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_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 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
left join f_equipment_fire_equipment fe on fe.fire_equipment_id = m.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 left join f_equipment f on f.id = fe.equipment_id
where substr(cat.code ,1,4) = '8501' where substr(cat.code ,1,4) = '8501'
...@@ -1547,6 +1549,7 @@ ...@@ -1547,6 +1549,7 @@
left join wl_equipment_category as cat on equ.category_id = cat.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_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 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)= '3105' where substr(cat.code ,1,4)= '3105'
UNION all UNION all
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, 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,
...@@ -1643,13 +1646,14 @@ ...@@ -1643,13 +1646,14 @@
'' as person, '' as person,
det.name as title, det.name as title,
concat('fireEquipment-',spe.id) as `key`, concat('fireEquipment-',spe.id) as `key`,
str.source_id as riskSourceId risk.source_id as riskSourceId
from wl_equipment_specific as spe from wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id 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 as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.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_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 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' where substr(cat.code ,1,4) = '3104'
UNION all UNION all
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, 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,
......
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