gushoubang 4 сар өмнө
parent
commit
0dd02a4742

+ 1 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/FzssServiceImpl.java

@@ -459,6 +459,7 @@ public class FzssServiceImpl implements IFzssService {
                     rawTable = createUtilsDBService.addColumnValue(rawTable, SJY, "jzxgd");
                     //3.保留符合高程值的地块
                     rawTable = createUtilsDBService.getHeightLimit(rawTable,"TB_JKXG");
+                    System.out.println("");
                 }
             }
             Integer tableCount = tableDateService.getTableCount(rawTable);

+ 27 - 23
onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/CreateUtilsDBMapper.xml

@@ -202,31 +202,35 @@
     </insert>
     <insert id="getHeightLimit">
         CREATE TABLE "${newTableName}" AS
-        WITH intersected AS (SELECT ta.id                            AS a_id,
-                                    ta.geom                          AS a_geom,
-                                    ta.height                        AS a_height,
-                                    tb.id                            AS b_id,
-                                    tb.geom                          AS b_geom,
-                                    tb.hight                         AS b_hight,
-                                    public.ST_Intersection(ta.geom, tb.geom) AS intersect_geom
-                             FROM "${tableNameA}" as ta
+        WITH intersected AS (SELECT ROW_NUMBER()                                OVER () AS ID, ta.ID AS a_id,
+                                    ta.geom                                  AS a_geom,
+                                    ta.height                                AS a_height,
+                                    tb.ID                                    AS b_id,
+                                    tb.geom                                  AS b_geom,
+                                    tb.hight                                 AS b_hight,
+                                    PUBLIC.ST_Intersection(ta.geom, tb.geom) AS intersect_geom
+                             FROM "${tableNameA}" AS ta
                                       JOIN
-                                  "${tableNameB}" as tb
+                                  "${tableNameB}" AS tb
                                   ON
-                                      public.ST_Intersects(ta.geom, tb.geom))
-        SELECT a_id as id,
-               intersect_geom AS geom,
-               a_height        AS height
-        FROM intersected
-        WHERE a_height &lt;= b_hight
+                                      PUBLIC.ST_Intersects(ta.geom, tb.geom)),
+             intersected_result AS (SELECT a_id                            AS id,
+                                           PUBLIC.ST_Union(intersect_geom) AS geom,
+                                           MAX(a_height)                   AS height
+                                    FROM intersected
+                                    WHERE a_height &lt;= b_hight
+                                    GROUP BY a_id),
+             non_intersected_result AS (SELECT ta.ID     AS id,
+                                               ta.geom   AS geom,
+                                               ta.height AS height
+                                        FROM "${tableNameA}" AS ta
+                                        WHERE NOT EXISTS (SELECT 1
+                                                          FROM "${tableNameB}" AS tb
+                                                          WHERE PUBLIC.ST_Intersects(ta.geom, tb.geom)))
+        SELECT *
+        FROM intersected_result
         UNION ALL
-        SELECT ta.id    AS id,
-               ta.geom  AS geom,
-               ta.height AS height
-        FROM "${tableNameA}" as ta
-        WHERE NOT EXISTS (SELECT 1
-                          FROM "${tableNameB}" as tb
-                          WHERE public.ST_Intersects(ta.geom, tb.geom));
-
+        SELECT *
+        FROM non_intersected_result;
     </insert>
 </mapper>

+ 4 - 0
sql/change

@@ -17,3 +17,7 @@ vector.tdgy_sj
 
 修改nacos中file中配置
   domain: http://192.168.60.88:9201
+
+12.16
+同步表
+vector.TB_JKXG