Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
station
YeeAmosFireAutoSysRoot
Commits
8701db0b
Commit
8701db0b
authored
Mar 03, 2022
by
maoying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改三维资源查询接口脚本
parent
19ac43e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
269 additions
and
1086 deletions
+269
-1086
dbTemplate_view3d.xml
...sStart/src/main/resources/db/mapper/dbTemplate_view3d.xml
+269
-1086
No files found.
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_view3d.xml
View file @
8701db0b
...
...
@@ -3,323 +3,6 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.fas.business.dao.mapper.View3dMapper"
>
<!-- <select id="getPointByType" resultType="com.yeejoin.amos.fas.core.common.response.RegionTreeResponse">-->
<!-- <choose>-->
<!-- <when test="type == 'riskSource'">-->
<!-- select-->
<!-- R.id,R.name,R.code,R.parent_id,R.ue4_location,R.ue4_rotation,R.ue4_extent,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(ue4_rotation),'[]','')='',NULL,R.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(ue4_location),'[]','')='',NULL,R.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- route_path,-->
<!-- rl.level,-->
<!-- CONCAT('level_',rl.level) as level_str,-->
<!-- 0 as is_region,-->
<!-- R.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_risk_level rl on rl.id = R.risk_level_id-->
<!-- where 1=1-->
<!-- AND R.risk_level_id is not null-->
<!-- AND R.is_region = 'FALSE'-->
<!-- </when>-->
<!-- <when test="type == 'patrol'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.coordinates) || LENGTH(trim(B.coordinates)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name as name,B.point_no as code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.coordinates as position3d,-->
<!-- B.status as level,-->
<!-- CONCAT('level_',B.status) as level_str-->
<!-- from f_risk_source R-->
<!-- left join p_point B on B.risk_source_id = R.id AND R.is_region='TRUE'-->
<!-- where 1=1-->
<!-- AND B.id is not null AND B.is_delete = 0-->
<!-- </when>-->
<!-- <when test="type == 'impEquipment'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.position3d) || LENGTH(trim(B.position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name,B.code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_equipment B on B.risk_source_id = R.id AND R.is_region='TRUE'-->
<!-- where 1=1-->
<!-- AND B.id is not null-->
<!-- </when>-->
<!-- <when test="type == 'monitorEquipment'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.position3d) || LENGTH(trim(B.position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name,B.code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_fire_equipment B on B.risk_source_id = R.id AND B.equip_classify = 0-->
<!-- where 1=1-->
<!-- AND B.id is not null-->
<!-- </when>-->
<!-- <when test="type == 'video'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.position3d) || LENGTH(trim(B.position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name,B.code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_fire_equipment B on B.risk_source_id = R.id AND B.equip_classify = 2-->
<!-- where 1=1-->
<!-- AND B.id is not null-->
<!-- </when>-->
<!-- <when test="type == 'fireEquipment'">-->
<!-- select tmp.id,tmp.name,tmp.type,tmp.position3d,tmp.ue4_rotation,tmp.ue4_location,tmp.code,R.id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(tmp.position3d) || LENGTH(trim(tmp.position3d)) <![CDATA[ <]]> 1,0,1) as isBind-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(tmp.ue4_rotation),'[]','')='',NULL,tmp.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(tmp.ue4_location),'[]','')='',NULL,tmp.ue4_location)),0,1) as isBind-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- from (-->
<!-- select id,name,'fireCar' as type,position3d,car_num as code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_fire_car-->
<!-- union all-->
<!-- select id,name,'fireEquipment' as type,position3d,code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_fire_equipment-->
<!-- where equip_classify =3-->
<!-- union all-->
<!-- select id,name,CASE-->
<!-- WHEN S.type = 1 then 'fireChamber'-->
<!-- WHEN S.type = 2 then 'fireFoamRoom'-->
<!-- END as type,position3d,code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_fire_station s-->
<!-- union all-->
<!-- select id,name,-->
<!-- CASE-->
<!-- WHEN W.type = 1 then 'hydrant'-->
<!-- WHEN W.type = 2 then 'pool'-->
<!-- END as type,position3d,code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_water_resource w-->
<!-- ) tmp-->
<!-- left join f_risk_source R on R.id = tmp.risk_source_id-->
<!-- </when>-->
<!-- </choose>-->
<!-- <if test="orgCode != null">-->
<!-- AND (R.org_code = #{orgCode} OR R.org_code like CONCAT(#{orgCode},'-%'))-->
<!-- </if>-->
<!-- </select>-->
<!-- <select id="getPointDetailByTypeAndId" resultType="java.util.HashMap">-->
<!-- <choose>-->
<!-- <when test="type == 'riskSource'">-->
<!-- select rs.id,rs.name,rs.code,rs.ue4_location as ue4Location,rs.ue4_rotation as ue4Rotation,rs.position3d,-->
<!-- rl.level,rl.name as levelStr,rs.floor3d ,rs.is_indoor as isIndoor,-->
<!-- rs.flicker_frequency as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- rs.rpn as title-->
<!-- from f_risk_source rs-->
<!-- left join f_risk_level rl ON rl.id = rs.risk_level_id-->
<!-- where 1=1-->
<!-- <if test="pointId != null">-->
<!-- AND rs.id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'patrol'">-->
<!-- select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,coordinates as position3d,-->
<!-- status,floor as floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- case p.status-->
<!-- when '0' then false-->
<!-- when '1' then false-->
<!-- else true-->
<!-- end as `showInfo`,-->
<!-- case p.status-->
<!-- when '0' then '未计划'-->
<!-- when '1' then '合格'-->
<!-- when '2' then '不合格'-->
<!-- when '3' then '漏检'-->
<!-- end as title,-->
<!-- case p.status-->
<!-- when '0' then '未计划'-->
<!-- when '1' then '合格'-->
<!-- when '2' then '不合格'-->
<!-- when '3' then '漏检'-->
<!-- end as levelStr,-->
<!-- #{type} as type,-->
<!-- status as level-->
<!-- from p_point p-->
<!-- where 1=1 and is_delete = 0-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'impEquipment'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_equipment-->
<!-- where 1=1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'monitorEquipment'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_equipment-->
<!-- where equip_classify = 0-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'video'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_equipment-->
<!-- where equip_classify = 2-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'hydrant'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_water_resource-->
<!-- where type = 1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'pool'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_water_resource-->
<!-- where type = 2-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireCar'">-->
<!-- select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_car-->
<!-- where 1=1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireEquipment'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_equipment-->
<!-- where equip_classify = 3-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireChamber'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_station-->
<!-- where type = 1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireFoamRoom'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_station-->
<!-- where type = 2-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- </choose>-->
<!-- </select>-->
<select
id=
"getSafetyIndexWeek"
resultType=
"java.util.HashMap"
>
<![CDATA[
...
...
@@ -561,227 +244,6 @@
5
</select>
<!-- <select id="getPintsByType" resultType="hashmap">-->
<!-- select CONCAT(type,'-',id) as `key`,sp.* from-->
<!-- (select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_risk_source where is_region = 'FALSE'-->
<!-- UNION all-->
<!-- select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'patrol' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from p_point WHERE is_delete = FALSE-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'impEquipment' as type,org_code as orgCode,-->
<!-- tmp.relationKeys-->
<!-- from f_equipment e-->
<!-- LEFT JOIN-->
<!-- (select GROUP_CONCAT(fire_equipment_id) as relationKeys,equipment_id from f_equipment_fire_equipment GROUP BY equipment_id) tmp-->
<!-- ON TMP.equipment_id = e.id-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'monitorEquipment' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_equipment where equip_classify = 0-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'video' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_equipment where equip_classify = 2-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'hydrant' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_water_resource where type = 1-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'pool' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_water_resource where type = 2-->
<!-- UNION all-->
<!-- select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation, 'fireCar' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_car-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'fireEquipment' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_equipment where equip_classify = 3-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation , 'fireChamber' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_station where type = 2-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'fireFoamRoom' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_station where type = 1-->
<!-- ) as sp-->
<!-- where-->
<!-- sp.orgCode = #{orgCode}-->
<!-- <if test="type!=null">and sp.type =#{type}</if>-->
<!-- </select>-->
<!-- <select id="getImpEqu3dPoints" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">-->
<!-- SELECT id,name,code,ue4_location,ue4_rotation,-->
<!-- case-->
<!-- when equip_classify= 0 then 'monitorEquipment'-->
<!-- when equip_classify= 2 then 'video'-->
<!-- when equip_classify= 3 then 'fireEquipment'-->
<!-- end as type,-->
<!-- case-->
<!-- when equip_classify= 0 then 'monitorEquipment'-->
<!-- when equip_classify= 2 then 'video'-->
<!-- when equip_classify= 3 then 'fireEquipment'-->
<!-- end as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(fe.position3d) || LENGTH(trim(fe.position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(fe.position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(fe.position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(fe.position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- concat('monitorEquipment-',fe.id) as `key`-->
<!-- FROM f_fire_equipment fe-->
<!-- WHERE fe.id IN (-->
<!-- select fire_equipment_id from f_equipment_fire_equipment-->
<!-- ) AND (org_code = #{orgCode} OR org_code LIKE CONCAT(#{orgCode},'-%'))-->
<!-- AND fe.equip_classify <![CDATA[ <> ]]> 1-->
<!-- UNION ALL-->
<!-- SELECT e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,'impEquipment' as type,'impEquipment' as level,-->
<!-- TMP.relationKeys,-->
<!-- 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 position,-->
<!-- concat('impEquipment-',e.id) as `key`-->
<!-- FROM f_equipment e-->
<!-- LEFT JOIN-->
<!-- (select GROUP_CONCAT(fire_equipment_id) as relationKeys,equipment_id from f_equipment_fire_equipment GROUP BY equipment_id) tmp-->
<!-- ON TMP.equipment_id = e.id-->
<!-- WHERE e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%')-->
<!-- UNION ALL-->
<!-- SELECT id,name,code,ue4_location,ue4_rotation,-->
<!-- case type-->
<!-- when 1 then 'hydrant'-->
<!-- when 2 then 'pool'-->
<!-- end as type,-->
<!-- case type-->
<!-- when 1 then 'hydrant'-->
<!-- when 2 then 'pool'-->
<!-- end as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- case type-->
<!-- when 1 then concat('hydrant-',id)-->
<!-- when 2 then concat('pool-',id)-->
<!-- end as `key`-->
<!-- FROM f_water_resource-->
<!-- WHERE org_code = #{orgCode} OR org_code like CONCAT(#{orgCode},'-%')-->
<!-- UNION ALL-->
<!-- SELECT id,name,code,ue4_location,ue4_rotation,-->
<!-- case-->
<!-- when type = 1 then 'fireChamber'-->
<!-- when type = 2 then 'fireFoamRoom'-->
<!-- end as type,-->
<!-- case-->
<!-- when type = 1 then 'fireChamber'-->
<!-- when type = 2 then 'fireFoamRoom'-->
<!-- end as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- concat('fireChamber-',id) as `key`-->
<!-- FROM f_fire_station-->
<!-- WHERE org_code = #{orgCode} OR org_code LIKE CONCAT(#{orgCode},'-%')-->
<!-- UNION ALL-->
<!-- SELECT id,name,car_num as code,ue4_location,ue4_rotation,'fireCar' as type,'fireCar' as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- concat('fireCar-',id) as `key`-->
<!-- FROM f_fire_car-->
<!-- WHERE org_code = #{orgCode} OR org_code LIKE CONCAT(#{orgCode},'-%')-->
<!-- </select>-->
<select
id=
"initViewErrorNode"
resultType=
"com.yeejoin.amos.fas.business.vo.View3dNodeVo"
>
select * from (
select
...
...
@@ -849,554 +311,278 @@
</if>
</select>
<!-- <select id="findViewDataByType" resultType="com.yeejoin.amos.fas.core.common.response.Node3DVoResponse">-->
<!-- SELECT-->
<!-- *-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- rs.code,-->
<!-- rs.id,-->
<!-- rs.is_indoor inDoor,-->
<!-- CONCAT('riskSource-', rs.id) 'key',-->
<!-- rs.`name` label,-->
<!-- rl.`level` 'level',-->
<!-- CONCAT('level_', rl.`level`) levelStr,-->
<!-- CONCAT('floor_1', floor3d) objKey,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(rs.position3d) || LENGTH(trim(rs.position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(rs.position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(rs.position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(rs.position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END positionDTO,-->
<!-- '{ "x": 0, "y": 0, "z": 0 }' rotationDTO,-->
<!-- '{ "x": 1, "y": 1, "z": 1 }' scaleDTO,-->
<!-- true as showInfo,-->
<!-- rs.rpn as title,-->
<!-- 'riskSource' type,-->
<!-- rs.org_code as orgCode,-->
<!-- rs.id as riskSourceId,-->
<!-- rs.flicker_frequency as frequency,-->
<!-- if('NORMAL'=rs.status,FALSE,TRUE) as twinkle-->
<!-- FROM-->
<!-- f_risk_source rs-->
<!-- LEFT JOIN f_risk_level rl ON rl.id = rs.risk_level_id-->
<!-- WHERE-->
<!-- rs.position3d IS NOT NULL-->
<!-- AND rs.position3d != ''-->
<!-- AND rs.risk_level_id is not null-->
<!-- <if test="abnormalStatus != false">-->
<!-- AND rs.status = 'ANOMALY'-->
<!-- </if>-->
<!-- AND rs.is_region <![CDATA[<>]]> 'TRUE'-->
<!-- UNION ALL-->
<!-- SELECT-->
<!-- eq.code,-->
<!-- id,-->
<!-- is_indoor inDoor,-->
<!-- CONCAT('impEquipment-', id) 'key',-->
<!-- `name` label,-->
<!-- '0' LEVEL,-->
<!-- 'level_0' levelStr,-->
<!-- CONCAT('floor_1', floor3d) objKey,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(eq.position3d) || LENGTH(trim(eq.position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(eq.position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(eq.position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(eq.position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END positionDTO,-->
<!-- '{ "x": 0, "y": 0, "z": 0 }' rotationDTO,-->
<!-- '{ "x": 1, "y": 1, "z": 1 }' scaleDTO,-->
<!-- FALSE as showInfo,-->
<!-- name as title,-->
<!-- 'impEquipment' type,-->
<!-- eq.org_code as orgCode,-->
<!-- eq.risk_source_id as riskSourceId,-->
<!-- 0 as frequency,-->
<!-- FALSE as twinkle-->
<!-- FROM-->
<!-- f_equipment eq-->
<!-- WHERE-->
<!-- position3d IS NOT NULL-->
<!-- AND eq.risk_source_id in (select id from f_risk_source where is_region='TRUE')-->
<!-- AND position3d != ''-->
<!-- <if test="abnormalStatus != false">-->
<!-- AND eq.id in-->
<!-- (select equipment_id from f_equipment_fire_equipment fefe-->
<!-- left join f_fire_equipment fe ON fe.id = fefe.fire_equipment_id-->
<!-- where fe.equip_status = 1)-->
<!-- </if>-->
<!-- UNION ALL-->
<!-- select-->
<!-- p.point_no code,-->
<!-- p.id,-->
<!-- p.is_indoor as inDoor,-->
<!-- CONCAT('patrol',p.id) as `key`,-->
<!-- p.name,-->
<!-- p.status as LEVEL,-->
<!-- CONCAT('level_',p.status) as levelStr,-->
<!-- CONCAT('floor',p.floor) as objKey,-->
<!-- 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,-->
<!-- '{ "x": 0, "y": 0, "z": 0 }' rotationDTO,-->
<!-- '{ "x": 1, "y": 1, "z": 1 }' scaleDTO,-->
<!-- case p.status-->
<!-- when '0'-->
<!-- then false-->
<!-- else-->
<!-- true-->
<!-- end as `showInfo`,-->
<!-- p.name as title,-->
<!-- 'patrol' as type,-->
<!-- p.org_code as orgCode,-->
<!-- p.risk_source_id as riskSourceId,-->
<!-- 0 as frequency,-->
<!-- if(p.status > 1 ,TRUE,FALSE) as twinkle-->
<!-- from-->
<!-- p_point p-->
<!-- left join f_risk_source rs on p.risk_source_id = rs.id AND rs.is_region='TRUE'-->
<!-- where rs.id is not null-->
<!-- <if test="abnormalStatus != false">-->
<!-- AND p.status in ('0','2','3')-->
<!-- </if>-->
<!-- AND p.coordinates != '' AND p.coordinates is not null AND p.is_delete = 0-->
<!-- UNION ALL-->
<!-- select-->
<!-- fe.code,-->
<!-- fe.id,-->
<!-- fe.is_indoor as inDoor,-->
<!-- case-->
<!-- when fe.equip_classify = 0 then CONCAT('monitorEquipment',fe.id)-->
<!-- when fe.equip_classify = 3 then CONCAT('fireEquipment',fe.id)-->
<!-- end as `key`,-->
<!-- fe.name,-->
<!-- '' as LEVEL,-->
<!-- '' as levelStr,-->
<!-- CONCAT('floor',fe.floor3d) as objKey,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(fe.position3d) || LENGTH(trim(fe.position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(fe.position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(fe.position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(fe.position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END positionDTO,-->
<!-- '{ "x": 0, "y": 0, "z": 0 }' rotationDTO,-->
<!-- '{ "x": 1, "y": 1, "z": 1 }' scaleDTO,-->
<!-- false as `showInfo`,-->
<!-- fe.name as title,-->
<!-- case-->
<!-- when fe.equip_classify = 0 then 'monitorEquipment'-->
<!-- when fe.equip_classify = 3 then 'fireEquipment'-->
<!-- end as type,-->
<!-- fe.org_code as orgCode,-->
<!-- fe.risk_source_id as riskSourceId,-->
<!-- 0 as frequency,-->
<!-- false as twinkle-->
<!-- from-->
<!-- f_fire_equipment fe-->
<!-- left join f_risk_source rs on fe.risk_source_id = rs.id AND rs.is_region='TRUE'-->
<!-- where rs.id is not null-->
<!-- <if test="abnormalStatus != false">-->
<!-- AND fe.equip_status = 1-->
<!-- </if>-->
<!-- AND fe.equip_classify in (0,2,3)-->
<!-- AND fe.position3d != '' AND fe.position3d is not null-->
<!-- UNION ALL-->
<!-- select-->
<!-- c.car_num code,-->
<!-- c.id,-->
<!-- c.is_indoor as inDoor,-->
<!-- CONCAT('fireCar',c.id) as `key`,-->
<!-- c.name,-->
<!-- '' as LEVEL,-->
<!-- '' as levelStr,-->
<!-- CONCAT('floor',c.floor3d) as objKey,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(c.position3d) || LENGTH(trim(c.position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(c.position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(c.position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(c.position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END positionDTO,-->
<!-- '{ "x": 0, "y": 0, "z": 0 }' rotationDTO,-->
<!-- '{ "x": 1, "y": 1, "z": 1 }' scaleDTO,-->
<!-- false as `showInfo`,-->
<!-- c.name as title,-->
<!-- 'fireCar' as type,-->
<!-- c.org_code as orgCode,-->
<!-- c.risk_source_id as riskSourceId,-->
<!-- 0 as frequency,-->
<!-- false as twinkle-->
<!-- from f_fire_car c-->
<!-- left join f_risk_source rs on c.risk_source_id = rs.id AND rs.is_region='TRUE'-->
<!-- where rs.id is not null-->
<!-- AND c.position3d != '' AND c.position3d is not null-->
<!-- UNION ALL-->
<!-- select-->
<!-- s.code,-->
<!-- s.id,-->
<!-- s.is_indoor as inDoor,-->
<!-- case-->
<!-- when S.type = 1 then CONCAT('fireChamber',s.id)-->
<!-- when S.type = 2 then CONCAT('fireFoamRoom',s.id)-->
<!-- end as `key`,-->
<!-- s.name,-->
<!-- '' as LEVEL,-->
<!-- '' as levelStr,-->
<!-- CONCAT('floor',s.floor3d) as objKey,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(s.position3d) || LENGTH(trim(s.position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(s.position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(s.position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(s.position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END positionDTO,-->
<!-- '{ "x": 0, "y": 0, "z": 0 }' rotationDTO,-->
<!-- '{ "x": 1, "y": 1, "z": 1 }' scaleDTO,-->
<!-- false as `showInfo`,-->
<!-- s.name as title,-->
<!-- case-->
<!-- when S.type = 1 then 'fireChamber'-->
<!-- when S.type = 2 then 'fireFoamRoom'-->
<!-- end as type,-->
<!-- s.org_code as orgCode,-->
<!-- s.risk_source_id as riskSourceId,-->
<!-- 0 as frequency,-->
<!-- false as twinkle-->
<!-- from-->
<!-- f_fire_station s-->
<!-- left join f_risk_source rs on s.risk_source_id = rs.id AND rs.is_region='TRUE'-->
<!-- where rs.id is not null-->
<!-- AND s.position3d != '' AND s.position3d is not null-->
<!-- UNION ALL-->
<!-- SELECT-->
<!-- wlv.CODE,-->
<!-- wlv.id,-->
<!-- '' AS inDoor,-->
<!-- CONCAT( 'video', wlv.id ) AS `key`,-->
<!-- wlv.NAME,-->
<!-- '' AS LEVEL,-->
<!-- '' AS levelStr,-->
<!-- '' AS objKey,-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index( wlv.position3d, ',', 1 ),-->
<!-- ',"y":',-->
<!-- substring_index( substring_index( wlv.position3d, ',', - 2 ), ',', 1 ),-->
<!-- ',"z":',-->
<!-- substring_index( wlv.position3d, ',', - 1 ),-->
<!-- '}'-->
<!-- )-->
<!-- as positionDTO,-->
<!-- '{ "x": 0, "y": 0, "z": 0 }' rotationDTO,-->
<!-- '{ "x": 1, "y": 1, "z": 1 }' scaleDTO,-->
<!-- FALSE AS `showInfo`,-->
<!-- wlv.NAME AS title,-->
<!-- 'video' AS type,-->
<!-- wlv.org_code AS orgCode,-->
<!-- '' AS riskSourceId,-->
<!-- 0 AS frequency,-->
<!-- FALSE AS twinkle-->
<!-- FROM-->
<!-- wl_video wlv-->
<!-- WHERE-->
<!-- wlv.position3d != ''-->
<!-- AND wlv.position3d IS NOT NULL-->
<!-- union all-->
<!-- select-->
<!-- w.code,-->
<!-- w.id,-->
<!-- w.is_indoor as inDoor,-->
<!-- case-->
<!-- when w.type = 1 then CONCAT('hydrant',w.id)-->
<!-- when w.type = 2 then CONCAT('pool',w.id)-->
<!-- end as `key`,-->
<!-- w.name,-->
<!-- '' as LEVEL,-->
<!-- '' as levelStr,-->
<!-- CONCAT('floor',w.floor3d) as objKey,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(w.position3d) || LENGTH(trim(w.position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(w.position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(w.position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(w.position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END positionDTO,-->
<!-- '{ "x": 0, "y": 0, "z": 0 }' rotationDTO,-->
<!-- '{ "x": 1, "y": 1, "z": 1 }' scaleDTO,-->
<!-- false as `showInfo`,-->
<!-- w.name as title,-->
<!-- case-->
<!-- when w.type = 1 then 'hydrant'-->
<!-- when w.type = 2 then 'pool'-->
<!-- end as type,-->
<!-- w.org_code as orgCode,-->
<!-- w.risk_source_id as riskSourceId,-->
<!-- 0 as frequency,-->
<!-- false as twinkle-->
<!-- from-->
<!-- f_water_resource w-->
<!-- left join f_risk_source rs on w.risk_source_id = rs.id AND rs.is_region='TRUE'-->
<!-- where rs.id is not null-->
<!-- AND w.position3d != '' AND w.position3d is not null-->
<!-- ) temp-->
<!-- WHERE 1=1-->
<!-- <if test="riskSourceId != null">-->
<!-- AND FIND_IN_SET(temp.riskSourceId,queryRiskSourceChildrenIds(#{riskSourceId}))-->
<!-- </if>-->
<!-- <if test="type != null and type !='fireResource' and type !=''">-->
<!-- AND temp.type = #{type}-->
<!-- </if>-->
<!-- <if test="type == 'fireResource'">-->
<!-- AND temp.type in ('fireCar','fireEquipment','fireChamber','fireFoamRoom','hydrant','pool')-->
<!-- </if>-->
<!-- <if test="orgCode != null">-->
<!-- AND (temp.orgCode = #{orgCode} OR temp.orgCode LIKE CONCAT(#{orgCode},'-%'))-->
<!-- </if>-->
<!-- </select>-->
<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
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.name,p.point_no as code,'patrol' as typeCode,p.org_code as orgCode, p.risk_source_id as riskSourceId
from p_point p
WHERE is_delete = FALSE
UNION all
select name,code,'impEquipment' as typeCode,org_code as orgCode, e.risk_source_id as riskSourceId
from f_equipment e
UNION all
-- 消防车
select
car.name ,
car_num 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
vi.name,
vi.code 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
group by vi.id
-- 建筑
UNION all
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
count(1)
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
det.name,
spe.code as code,
'monitorEquipment' as typeCode,
spe.org_code as orgCode,
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
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) = '9204'
<if
test=
"protectObjName != null and protectObjName != ''"
>
AND f.name = #{protectObjName}
</if>
-- 消火栓 灭火器
UNION all
select
det.name,
spe.code as code,
'fireEquipment' as typeCode,
spe.org_code as orgCode,
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
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) in (3104,3105) and risk.source_id is not null
) as tmp
where 1=1
<if
test=
"inputText!=null and inputText != ''"
>
AND (
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 tmp.riskSourceId = #{riskSourceId}
</if>
<if
test=
"orgCode!=null"
>
AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') )
</if>
(
SELECT
*
FROM
(
SELECT
r.`code`,
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.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.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.org_code AS orgCode,
'monitorEquipment' AS typeCode,
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
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.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 f ON f.id = fe.equipment_id
WHERE
substr(cat.`code`, 1, 4) = '9204'
<if
test =
"protectObjName != null and protectObjName != ''"
>
AND f.`name` = #{protectObjName}
</if>
GROUP BY
m.`code`
UNION ALL
SELECT
vi.`code`,
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.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.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.org_code AS orgCode,
'fireEquipment' AS typeCode,
#{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
spe.`code` AS code,
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.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.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 != ''"
>
AND (
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 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
...
...
@@ -1855,9 +1041,6 @@
<if
test=
"riskSourceId != null"
>
AND tmp.riskSourceId = #{riskSourceId}
</if>
<if
test=
"orgCode!=null"
>
AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') )
</if>
</where>
LIMIT ${start},${length}
</select>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment