瀏覽代碼

添加二维实体数据信息接口

DESKTOP-2K9OVK9\siwei 4 月之前
父節點
當前提交
cc163f91f1

+ 18 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/dimentity/EntityRelationshipVo.java

@@ -1,10 +1,27 @@
 package com.onemap.apply.domain.dimentity;
 
 public class EntityRelationshipVo {
-
+    private String entityid;
+    private String entilayer;
     private String tylayer; //图层表名
     private String elementid; //关联数据
 
+    public String getEntityid() {
+        return entityid;
+    }
+
+    public void setEntityid(String entityid) {
+        this.entityid = entityid;
+    }
+
+    public String getEntilayer() {
+        return entilayer;
+    }
+
+    public void setEntilayer(String entilayer) {
+        this.entilayer = entilayer;
+    }
+
     public String getElementid() {
         return elementid;
     }

+ 3 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/dimentity/DimEntityMapper.java

@@ -38,7 +38,9 @@ public interface DimEntityMapper {
      */
     List<EntityRelationshipVo> queryEntityRelationshipDataByEntityId(@Param("EntityId") String EntityId, @Param("tables") List<String> tablesName);
 
-    Map<String, Object> queryEntityDataByEntityId(@Param("tylayer") String tylayer, @Param("elementid") String elementid);
+    Map<String, Object> queryEntityDataByEntityId(@Param("tableName") String tableName, @Param("entityid") String entityid);
+
+    Map<String, Object> queryEntityGeomDataByEntityId(@Param("tylayer") String tylayer, @Param("elementid") String elementid);
 
     /**
      * 根据实体分类,通過视图获取表名

+ 1 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/dimentity/DimEntityService.java

@@ -8,5 +8,5 @@ import java.util.Map;
 public interface DimEntityService {
     List<EntityCodeTreeVo> queryEntityCodeTableTree(String id);
 
-    List<Map<String, Object>> queryEntityData(String entityid);
+    Map<String, Object> queryEntityData(String entityid);
 }

+ 15 - 10
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/dimentity/impl/DimEntityServiceImpl.java

@@ -8,10 +8,7 @@ import com.onemap.common.core.utils.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class DimEntityServiceImpl implements DimEntityService {
@@ -44,21 +41,29 @@ public class DimEntityServiceImpl implements DimEntityService {
     }
 
     @Override
-    public List<Map<String, Object>> queryEntityData(String entityid) {
+    public Map<String, Object> queryEntityData(String entityid) {
+        Map<String, Object> result = new HashMap<>();
         //获取所有的实体关系表
         List<String> tablesList = dimEntityMapper.querySchemaTableByName("vector", "实体图元关联表");
         if (tablesList == null || tablesList.size() == 0) {
-            return Collections.emptyList();
+            return result;
         }
         List<EntityRelationshipVo> relationshipVos = dimEntityMapper.queryEntityRelationshipDataByEntityId(entityid, tablesList);
         if (relationshipVos == null || relationshipVos.size() == 0) {
-            return Collections.emptyList();
+            return result;
         }
-        List<Map<String, Object>> ret = new ArrayList<Map<String, Object>>();
+        //查询对象形象
+        EntityRelationshipVo d0_relationshipVo = relationshipVos.get(0);
+        String d0_entilayer = d0_relationshipVo.getEntilayer();
+        Map<String, Object> d0_EntityData = dimEntityMapper.queryEntityDataByEntityId(d0_entilayer, entityid);
+        result.put("info", d0_EntityData);
+        //查询空间详细数据
+        List<Map<String, Object>> geomList = new ArrayList<Map<String, Object>>();
         for (EntityRelationshipVo relationshipVo : relationshipVos) {
-            ret.add(dimEntityMapper.queryEntityDataByEntityId(relationshipVo.getTylayer(), relationshipVo.getElementid()));
+            geomList.add(dimEntityMapper.queryEntityGeomDataByEntityId(relationshipVo.getTylayer(), relationshipVo.getElementid()));
         }
-        return ret;
+        result.put("geom", geomList);
+        return result;
     }
 
     private void createView(String viewTableName) {

+ 20 - 9
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/dimentity/DimEntityMapper.xml

@@ -13,10 +13,10 @@
     <resultMap type="EntityRelationshipVo" id="EntityRelationshipVoResult">
         <result property="tylayer" column="tylayer"/>
         <result property="elementid" column="elementid"/>
+        <result property="entityid" column="entityid"/>
+        <result property="entilayer" column="entilayer"/>
     </resultMap>
 
-
-
     <select id="queryEntityCodeTable" parameterType="String" resultMap="EntityCodeTreeVoResult">
         SELECT t1.id,t1.label from (
         <choose>
@@ -46,8 +46,9 @@
 
     <select id="queryEntityCodeTableTreeDataByCode" parameterType="String" resultMap="EntityCodeTreeVoResult">
         select * from (
-        <foreach item="item" index="index" collection="tables" separator="UNION ALL" >
-            select entityid::varchar as id, case when entityname::varchar = 'null' then entityid::varchar else  entityname::varchar  end as label,
+        <foreach item="item" index="index" collection="tables" separator="UNION ALL">
+            select entityid::varchar as id, case when entityname::varchar = 'null' then entityid::varchar else
+            entityname::varchar end as label,
             false disabled,0 as count
             from vector.${item} where classid::varchar like concat(#{code},'%')
         </foreach>
@@ -56,18 +57,26 @@
 
     <select id="queryEntityRelationshipDataByEntityId" parameterType="String" resultMap="EntityRelationshipVoResult">
         select * from (
-        <foreach item="item" index="index" collection="tables" separator="UNION ALL" >
-            select entityid,tylayer,elementid from vector.${item} where entityid = #{EntityId}
+        <foreach item="item" index="index" collection="tables" separator="UNION ALL">
+            select entityid,entilayer,tylayer,elementid from vector.${item} where entityid = #{EntityId}
         </foreach>
         )v1
     </select>
 
     <select id="queryEntityDataByEntityId" parameterType="String" resultType="map">
-        select *,public.st_asewkt(geom) geomewkt from vector.${tylayer} where elementid = #{elementid}
+        select *  from vector.${tableName}  where entityid = #{entityid}
+    </select>
+
+    <select id="queryEntityGeomDataByEntityId" parameterType="String" resultType="map">
+        select *, public.st_asewkt(geom) siweigeomewkt
+        from vector.${tylayer}
+        where elementid = #{elementid}
     </select>
 
     <select id="queryTablesNameByViewCode" parameterType="String" resultType="String">
-        select v1.entilayer from (select  entilayer from vector.${viewName} where fourcode like concat(#{code},'%'))v1 group by v1.entilayer
+        select v1.entilayer
+        from (select entilayer from vector.${viewName} where fourcode like concat(#{code}, '%')) v1
+        group by v1.entilayer
     </select>
 
 
@@ -79,7 +88,9 @@
 
     <update id="createEntityCodeTableDataViewByTableSql" parameterType="String">
         create
-        OR REPLACE view vector.${viewName} as
+        OR REPLACE view vector.
+        ${viewName}
+        as
         select v2.fourcode, v1.entilayer
         from (SELECT x.entilayer
               FROM (