Commit 67d69f24 authored by zhengjiawei's avatar zhengjiawei

sql

parent ce6ca1a7
......@@ -1215,9 +1215,7 @@
</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
......@@ -1277,7 +1275,7 @@
spe.code as code,
'monitorEquipment' as typeCode,
spe.org_code as orgCode,
risk.source_id as risk_source_id
risk.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
......@@ -1286,7 +1284,7 @@
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) = 8501
where substr(cat.code ,1,4) = 8501 and risk.source_id is not null
<if test="protectObjName != null and protectObjName != ''">
AND f.name = #{protectObjName}
</if>
......@@ -1297,7 +1295,7 @@
spe.code as code,
'fireEquipment' as typeCode,
spe.org_code as orgCode,
risk.source_id as risk_source_id
risk.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
......@@ -1306,7 +1304,7 @@
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) in (3104,3105)
where substr(cat.code ,1,4) in (3104,3105) and risk.source_id is not null
) as tmp
where 1=1
<if test="inputText!=null and inputText != ''" >
......@@ -1324,7 +1322,6 @@
<if test="orgCode!=null">
AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') )
</if>
</select>
<select id="retrieveAll" resultType="java.util.HashMap">
......@@ -1461,7 +1458,7 @@
'' as person,
det.name as title,
concat('monitorEquipment-',m.id) as `key`,
risk.source_id as riskSourceId
risk.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
......@@ -1471,7 +1468,7 @@
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 f on f.id = fe.equipment_id
where substr(cat.code ,1,4) = '8501'
where substr(cat.code ,1,4) = '8501' and risk.source_id is not null
group By m.code
<if test="protectObjName != null and protectObjName != ''">
AND f.name = #{protectObjName}
......@@ -1541,7 +1538,7 @@
'' as person,
det.name as title,
concat('hydrant-',spe.id) as `key`,
str.source_id as riskSourceId
risk.id as riskSourceId
from
wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
......@@ -1550,7 +1547,7 @@
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)= '3105'
where substr(cat.code ,1,4)= '3105' and risk.source_id is not null
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,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防水池' as typeName,'fireEquipment' as typeCode,
......@@ -1646,7 +1643,7 @@
'' as person,
det.name as title,
concat('fireEquipment-',spe.id) as `key`,
risk.source_id as riskSourceId
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
......@@ -1654,7 +1651,7 @@
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'
where substr(cat.code ,1,4) = '3104' and risk.source_id is not null
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,
0 as level , 'level_0' as levelStr,null as isIndoor,'泡沫间' as typeName,'fireEquipment' as typeCode,
......@@ -1740,8 +1737,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