Преглед изворни кода

相交不相交逻辑添加

gushoubang пре 9 месеци
родитељ
комит
6775094085
14 измењених фајлова са 237 додато и 29 уклоњено
  1. 43 6
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/controller/analyse/CreateUtilsDBController.java
  2. 14 0
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/controller/analyse/GetTableDateController.java
  3. 11 0
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/domain/vo/TableNameIdsVo.java
  4. 1 1
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/domain/vo/TableWktVo.java
  5. 10 0
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/domain/vo/TablesAIdsVo.java
  6. 18 0
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/mapper/vector/CreateUtilsDBMapper.java
  7. 3 0
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/mapper/vector/TableDataMapper.java
  8. 23 0
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/CreateUtilsDBService.java
  9. 3 0
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/ITableDateService.java
  10. 38 4
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/CreateUtilsDBServiceImpl.java
  11. 21 15
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/FzssServiceImpl.java
  12. 7 0
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/TableDateServiceImpl.java
  13. 31 3
      onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/CreateUtilsDBMapper.xml
  14. 14 0
      onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/TableDateMapper.xml

+ 43 - 6
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/controller/analyse/CreateUtilsDBController.java

@@ -58,19 +58,38 @@ public class CreateUtilsDBController extends BaseController {
         return RequestResult.success(result);
     }
 
+
+    /**
+     * 生成表tableNameB空间数据的差集,B-ST_Intersection(A,B)
+     *
+     * @param tableWktVo
+     * @return
+     */
+    @PostMapping("/difference/table_wkt")
+    @Slave
+    public RequestResult differenceTableWkt(@RequestBody TableWktVo tableWktVo) {
+        String newTable = createUtilsDBService.differenceTableWkt(
+                tableWktVo.getTableName(),
+                tableWktVo.getTableIds(),
+                tableWktVo.getEwkt());
+        Map<String, String> result = new HashMap<>();
+        result.put("tableName", newTable);
+        return RequestResult.success(result);
+    }
+
     /**
      * 生成表tableNameB空间数据的差集,B-ST_Intersection(A,B)
      *
-     * @param differenceTablesVo
+     * @param tablesAIdsVo
      * @return
      */
     @PostMapping("/difference/tables")
     @Slave
-    public RequestResult differenceTables(@RequestBody DifferenceTablesVo differenceTablesVo) {
+    public RequestResult differenceTables(@RequestBody TablesAIdsVo tablesAIdsVo) {
         String newTable = createUtilsDBService.differenceTables(
-                differenceTablesVo.getTableNameA(),
-                differenceTablesVo.getTableIdsA(),
-                differenceTablesVo.getTableNameB());
+                tablesAIdsVo.getTableNameA(),
+                tablesAIdsVo.getTableIdsA(),
+                tablesAIdsVo.getTableNameB());
         Map<String, String> result = new HashMap<>();
         result.put("tableName", newTable);
         return RequestResult.success(result);
@@ -84,7 +103,7 @@ public class CreateUtilsDBController extends BaseController {
      */
     @PostMapping("/intersection/table_wkt")
     @Slave
-    public RequestResult intersectionTableWkt(@RequestBody IntersectionTableWktVo intersectionTableWktVo) {
+    public RequestResult intersectionTableWkt(@RequestBody TableWktVo intersectionTableWktVo) {
         String newTable = createUtilsDBService.intersectionTableWkt(
                 intersectionTableWktVo.getTableName(),
                 intersectionTableWktVo.getTableIds(),
@@ -93,4 +112,22 @@ public class CreateUtilsDBController extends BaseController {
         result.put("tableName", newTable);
         return RequestResult.success(result);
     }
+
+    /**
+     * table中与wkt数据取交集
+     *
+     * @param tablesAIdsVo
+     * @return
+     */
+    @PostMapping("/intersection/tables")
+    @Slave
+    public RequestResult intersectionTables(@RequestBody TablesAIdsVo tablesAIdsVo) {
+        String newTable = createUtilsDBService.intersectionTables(
+                tablesAIdsVo.getTableNameA(),
+                tablesAIdsVo.getTableIdsA(),
+                tablesAIdsVo.getTableNameB());
+        Map<String, String> result = new HashMap<>();
+        result.put("tableName", newTable);
+        return RequestResult.success(result);
+    }
 }

+ 14 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/controller/analyse/GetTableDateController.java

@@ -2,6 +2,7 @@ package com.onemap.analyse.controller.analyse;
 
 import com.onemap.analyse.domain.vo.RawTableLengthVo;
 import com.onemap.analyse.domain.vo.RawTableVo;
+import com.onemap.analyse.domain.vo.TableNameIdsVo;
 import com.onemap.analyse.domain.vo.TargetTableVo;
 import com.onemap.analyse.service.ITableDateService;
 import com.onemap.common.core.web.domain.RequestResult;
@@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -62,4 +64,16 @@ public class GetTableDateController {
         List<Map<String, Object>> mapInfos = tableDateService.getRawTableLength(rawTableLengthVo);
         return RequestResult.success(mapInfos);
     }
+
+    /**
+     * 查询表格中geom的并集,返回ewkt
+     */
+    @PostMapping("/geom_union")
+    @Slave
+    public RequestResult geomUnion(@RequestBody TableNameIdsVo tableNameIdsVo) {
+        String ewkt = tableDateService.getGeomUnion(tableNameIdsVo);
+        Map<String, String> map = new HashMap<>();
+        map.put("ewkt", ewkt);
+        return RequestResult.success(map);
+    }
 }

+ 11 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/domain/vo/TableNameIdsVo.java

@@ -0,0 +1,11 @@
+package com.onemap.analyse.domain.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class TableNameIdsVo {
+    private String tableName;
+    private List<String> tableIds;
+}

+ 1 - 1
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/domain/vo/IntersectionTableWktVo.java → onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/domain/vo/TableWktVo.java

@@ -5,7 +5,7 @@ import lombok.Data;
 import java.util.List;
 
 @Data
-public class IntersectionTableWktVo {
+public class TableWktVo {
     private String tableName;
     private List<String> tableIds;
     private String ewkt;

+ 10 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/domain/vo/TablesAIdsVo.java

@@ -0,0 +1,10 @@
+package com.onemap.analyse.domain.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class TablesAIdsVo extends TableABBean{
+    List<String> tableIdsA;
+}

+ 18 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/mapper/vector/CreateUtilsDBMapper.java

@@ -46,6 +46,15 @@ public interface CreateUtilsDBMapper {
                           @Param("newTableName") String newTableName,
                           @Param("temporaryTable") String temporaryTable);
 
+    /**
+     * 生成表tableName空间数据的差集,tableName-ewkt
+     */
+    @Slave
+    void differenceTableWkt(@Param("tableName") String tableName,
+                            @Param("tableIds") List<String> tableIds,
+                            @Param("ewkt") String ewkt,
+                            @Param("newTableName") String newTableName);
+
     /**
      * 计算tableName 空间数据的缓冲区,并存储成新的表
      *
@@ -58,4 +67,13 @@ public interface CreateUtilsDBMapper {
                               @Param("tableIds") List<String> tableIds,
                               @Param("ewkt") String ewkt,
                               @Param("newTableName") String newTableName);
+
+    /**
+     * 生成表tableNameA与表tableNameB的空间交集
+     */
+    @Slave
+    void intersectionTables(@Param("tableNameA") String tableNameA,
+                            @Param("tableIdsA") List<String> tableIdsA,
+                            @Param("tableNameB") String tableNameB,
+                            @Param("newTableName") String newTableName);
 }

+ 3 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/mapper/vector/TableDataMapper.java

@@ -2,6 +2,7 @@ package com.onemap.analyse.mapper.vector;
 
 import com.onemap.analyse.domain.vo.RawTableLengthVo;
 import com.onemap.analyse.domain.vo.RawTableVo;
+import com.onemap.analyse.domain.vo.TableNameIdsVo;
 import com.onemap.analyse.domain.vo.TargetTableVo;
 import com.onemap.common.datasource.annotation.Slave;
 
@@ -15,4 +16,6 @@ public interface TableDataMapper {
     List<Map<String, Object>> getRawTableLength(RawTableLengthVo rawTableLengthVo);
 
     List<Map<String, Object>> getTargetTable(TargetTableVo targetTableVo);
+
+    String getGeomUnion(TableNameIdsVo tableNameIdsVo);
 }

+ 23 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/CreateUtilsDBService.java

@@ -36,6 +36,18 @@ public interface CreateUtilsDBService {
                             List<String> tableIdsA,
                             String tableNameB);
 
+    /**
+     * 生成表tableName空间数据的差集,tableName-ewkt
+     *
+     * @param tableName
+     * @param tableIds
+     * @param ewkt
+     * @return
+     */
+    String differenceTableWkt(String tableName,
+                            List<String> tableIds,
+                            String ewkt);
+
     /**
      * table中与wkt数据取交集
      *
@@ -48,4 +60,15 @@ public interface CreateUtilsDBService {
             String tableName,
             List<String> tableIds,
             String ewkt);
+
+    /**
+     * 生成表tableNameA与表tableNameB的空间交集
+     * @param tableNameA
+     * @param tableIdsA
+     * @param tableNameB
+     * @return
+     */
+    String intersectionTables(String tableNameA,
+                            List<String> tableIdsA,
+                            String tableNameB);
 }

+ 3 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/ITableDateService.java

@@ -2,6 +2,7 @@ package com.onemap.analyse.service;
 
 import com.onemap.analyse.domain.vo.RawTableLengthVo;
 import com.onemap.analyse.domain.vo.RawTableVo;
+import com.onemap.analyse.domain.vo.TableNameIdsVo;
 import com.onemap.analyse.domain.vo.TargetTableVo;
 
 import java.util.List;
@@ -16,4 +17,6 @@ public interface ITableDateService {
     List<Map<String, Object>> getRawTableLength(RawTableLengthVo rawTableLengthVo);
 
     List<Map<String, Object>> getTargetTable(TargetTableVo targetTableVo);
+
+    String getGeomUnion(TableNameIdsVo tableNameIdsVo);
 }

+ 38 - 4
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/CreateUtilsDBServiceImpl.java

@@ -2,6 +2,7 @@ package com.onemap.analyse.service.impl;
 
 import com.onemap.analyse.mapper.vector.CreateUtilsDBMapper;
 import com.onemap.analyse.service.CreateUtilsDBService;
+import org.bouncycastle.util.Strings;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -17,7 +18,9 @@ public class CreateUtilsDBServiceImpl implements CreateUtilsDBService {
     @Override
     public String bufferTable(String tableName, float radius) {
         long timestamp = System.currentTimeMillis();
-        String newTableName = TEMPORARY + "_" + timestamp + "_buffer_" + tableName;
+        String[] tableNames = Strings.split(tableName, '_');
+
+        String newTableName = TEMPORARY + "_" + timestamp + "_buffer_" + tableNames[tableNames.length - 1];
         createUtilsDBMapper.bufferTable(tableName, radius, newTableName);
         return newTableName;
     }
@@ -25,25 +28,56 @@ public class CreateUtilsDBServiceImpl implements CreateUtilsDBService {
     @Override
     public String bufferTable(String tableName, String column) {
         long timestamp = System.currentTimeMillis();
-        String newTableName = TEMPORARY + "_" + timestamp + "_buffer_" + tableName;
+        String[] tableNames = Strings.split(tableName, '_');
+
+        String newTableName = TEMPORARY + "_" + timestamp + "_buffer_" + tableNames[tableNames.length - 1];
+        ;
         createUtilsDBMapper.bufferColumnTable(tableName, column, newTableName);
         return newTableName;
     }
 
+    @Override
+    public String differenceTableWkt(String tableName, List<String> tableIds, String ewkt) {
+        long timestamp = System.currentTimeMillis();
+        String[] tableNames = Strings.split(tableName, '_');
+
+        String newTableName = TEMPORARY + "_" + timestamp + "_diff_wkt_" + tableNames[tableNames.length - 1];
+        createUtilsDBMapper.differenceTableWkt(tableName, tableIds, ewkt, newTableName);
+        return newTableName;
+    }
+
     @Override
     public String differenceTables(String tableNameA, List<String> tableIdsA, String tableNameB) {
         long timestamp = System.currentTimeMillis();
-        String newTableName = TEMPORARY + "_" + timestamp + "_" + tableNameA + "_diff_" + tableNameB;
+        String[] tableNamesA = Strings.split(tableNameA, '_');
+        String[] tableNamesB = Strings.split(tableNameB, '_');
+
+        String newTableName = TEMPORARY + "_" + timestamp + "_" + tableNamesA[tableNamesA.length - 1] + "_diff_" + tableNamesB[tableNamesB.length - 1];
+
         String temporaryTable = "temporaryTable_" + timestamp;
         createUtilsDBMapper.differenceTables(tableNameA, tableIdsA, tableNameB, newTableName, temporaryTable);
         return newTableName;
     }
 
+
     @Override
     public String intersectionTableWkt(String tableName, List<String> tableIds, String ewkt) {
         long timestamp = System.currentTimeMillis();
-        String newTableName = TEMPORARY + "_" + timestamp + "_inter_" + tableName;
+        String[] tableNames = Strings.split(tableName, '_');
+
+        String newTableName = TEMPORARY + "_" + timestamp + "_inter_wkt_" + tableNames[tableNames.length - 1];
         createUtilsDBMapper.intersectionTableWkt(tableName, tableIds, ewkt, newTableName);
         return newTableName;
     }
+
+    @Override
+    public String intersectionTables(String tableNameA, List<String> tableIdsA, String tableNameB) {
+        long timestamp = System.currentTimeMillis();
+        String[] tableNamesA = Strings.split(tableNameA, '_');
+        String[] tableNamesB = Strings.split(tableNameB, '_');
+
+        String newTableName = TEMPORARY + "_" + timestamp + "_" + tableNamesA[tableNamesA.length - 1] + "_inter_table_" + tableNamesB[tableNamesB.length - 1];
+        createUtilsDBMapper.intersectionTables(tableNameA, tableIdsA, tableNameB, newTableName);
+        return newTableName;
+    }
 }

+ 21 - 15
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/FzssServiceImpl.java

@@ -2,15 +2,13 @@ package com.onemap.analyse.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.onemap.analyse.controller.analyse.AnalyseUtilsDBController;
-import com.onemap.analyse.controller.analyse.CreateUtilsDBController;
 import com.onemap.analyse.domain.*;
 import com.onemap.analyse.domain.calculation.FzxzCalc;
-import com.onemap.analyse.domain.query.GhdkaFilter;
 import com.onemap.analyse.domain.res.FzxzResultDTO;
 import com.onemap.analyse.domain.res.GeomRes;
-import com.onemap.analyse.domain.vo.IntersectionTableWktVo;
+import com.onemap.analyse.domain.vo.TableWktVo;
 import com.onemap.analyse.domain.vo.SelectPilotVo;
+import com.onemap.analyse.domain.vo.TableNameIdsVo;
 import com.onemap.analyse.mapper.*;
 import com.onemap.analyse.mapper.base.FzxzResMapper;
 import com.onemap.analyse.mapper.base.ShpFileMapper;
@@ -112,6 +110,8 @@ public class FzssServiceImpl implements IFzssService {
     // AnalyseUtilsDBController analyseUtilsDBController;
     @Resource
     private CreateUtilsDBService createUtilsDBService;
+    @Resource
+    private TableDateServiceImpl tableDateService;
     //**需要拿出来的逻辑**//
 
     /**
@@ -210,7 +210,7 @@ public class FzssServiceImpl implements IFzssService {
 
         // 地块切割
         String ewkt = geomRes.getGeom();
-        IntersectionTableWktVo intersectionTableWktVo = new IntersectionTableWktVo();
+        TableWktVo intersectionTableWktVo = new TableWktVo();
         intersectionTableWktVo.setTableName(fzxzDTO.getSjy());
         intersectionTableWktVo.setEwkt(ewkt);
         String temporaryTable = createUtilsDBService.intersectionTableWkt(intersectionTableWktVo.getTableName(), null, intersectionTableWktVo.getEwkt());
@@ -282,40 +282,45 @@ public class FzssServiceImpl implements IFzssService {
      * @param factorUseDTOS
      * @param ewkt
      */
-    private void factorFilter(String taskId, String rawTable, List<FactorUseDTO> factorUseDTOS, String ewkt) {
+    private String factorFilter(String taskId, String rawTable, List<FactorUseDTO> factorUseDTOS, String ewkt) {
+
         for (FactorUseDTO factorUseDTO : factorUseDTOS) {
             if (factorUseDTO.getSpatialType().equals("intersect")) {
                 // 相交判断
                 // 1.先切割因子地块
-                String temporaryTable = createUtilsDBService.intersectionTableWkt(factorUseDTO.getFactorBsm(), null, ewkt);
-                Integer integer = ghdkaMapper.getTableCount(temporaryTable);
+                String tempTable = createUtilsDBService.intersectionTableWkt(factorUseDTO.getFactorBsm(), null, ewkt);
+                Integer integer = ghdkaMapper.getTableCount(tempTable);
                 if (integer == 0) {
                     // TODO 再定
                     iLogService.saveLog(taskId, "辅助选址", factorUseDTO.getFactorName() + "因子影响分析完成", "info");
                     continue;
                 }
                 // 2.生成因子地块缓冲区
-                if (factorUseDTO.getDefaultValue() == 0) {
+                if (factorUseDTO.getDefaultValue() != 0) {
                     // 没有值直接计算
-                    temporaryTable = createUtilsDBService.bufferTable(temporaryTable, factorUseDTO.getDefaultValue());
+                    tempTable = createUtilsDBService.bufferTable(tempTable, factorUseDTO.getDefaultValue());
 
-                    integer = ghdkaMapper.getTableCount(temporaryTable);
+                    integer = ghdkaMapper.getTableCount(tempTable);
                     if (integer == 0) {
                         // TODO 再定
                         iLogService.saveLog(taskId, "辅助选址", factorUseDTO.getFactorName() + "因子影响分析完成", "info");
                         continue;
                     }
                 }
-
                 // 3.地块切割
+                // 3.1查询需要切割的地块
+                TableNameIdsVo tableNameIdsVo = new TableNameIdsVo();
+                tableNameIdsVo.setTableName(tempTable);
+                String calculateEwkt = tableDateService.getGeomUnion(tableNameIdsVo);
+
+                // 3.2切割
                 if (factorUseDTO.getDefaultType().equals("intersect")) {
                     // 相交判断
-                    temporaryTable = createUtilsDBService.differenceTables(rawTable, null, temporaryTable);
+                    rawTable = createUtilsDBService.intersectionTableWkt(rawTable, null, calculateEwkt);
                 } else {
                     // 不相交判断
-                    temporaryTable = createUtilsDBService.differenceTables(rawTable, null, temporaryTable);
+                    rawTable = createUtilsDBService.differenceTableWkt(rawTable, null, calculateEwkt);
                 }
-                System.out.println(temporaryTable);
             } else if (factorUseDTO.getSpatialType().equals("contain")) {
                 // 包含判断
                 if (factorUseDTO.getDefaultValue() == 0) {
@@ -339,6 +344,7 @@ public class FzssServiceImpl implements IFzssService {
             }
             iLogService.saveLog(taskId, "辅助选址", factorUseDTO.getFactorName() + "因子影响分析完成", "info");
         }
+        return rawTable;
     }
 
     /**

+ 7 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/TableDateServiceImpl.java

@@ -2,6 +2,7 @@ package com.onemap.analyse.service.impl;
 
 import com.onemap.analyse.domain.vo.RawTableLengthVo;
 import com.onemap.analyse.domain.vo.RawTableVo;
+import com.onemap.analyse.domain.vo.TableNameIdsVo;
 import com.onemap.analyse.domain.vo.TargetTableVo;
 import com.onemap.analyse.mapper.vector.TableDataMapper;
 import com.onemap.analyse.service.ITableDateService;
@@ -33,4 +34,10 @@ public class TableDateServiceImpl implements ITableDateService {
         List<Map<String, Object>> list = tableDataMapper.getTargetTable(targetTableVo);
         return list;
     }
+
+    @Override
+    public String getGeomUnion(TableNameIdsVo tableNameIdsVo) {
+        String ewkt = tableDataMapper.getGeomUnion(tableNameIdsVo);
+        return ewkt;
+    }
 }

+ 31 - 3
onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/CreateUtilsDBMapper.xml

@@ -5,13 +5,13 @@
 <mapper namespace="com.onemap.analyse.mapper.vector.CreateUtilsDBMapper">
     <insert id="bufferTable">
         CREATE TABLE "${newTableName}" AS
-        SELECT id, public.ST_Buffer(geom::public.geography, #{radius})::public.geometry AS geom
+        SELECT id, public.ST_Buffer(geom::public.geography, #{radius}) ::public.geometry AS geom
         FROM "${tableName}"
         WHERE geom IS NOT NULL
     </insert>
     <insert id="bufferColumnTable">
         CREATE TABLE "${newTableName}" AS
-        SELECT id, public.ST_Buffer(geom::public.geography, ${column})::public.geometry AS geom
+        SELECT id, public.ST_Buffer(geom::public.geography, ${column}) ::public.geometry AS geom
         FROM "${tableName}"
         WHERE geom IS NOT NULL
     </insert>
@@ -44,11 +44,26 @@
             <foreach collection="tableIdsA" item="tableId" open="(" close=")" separator=",">
                 #{tableId}
             </foreach>
-        </if>;
+        </if>
+        ;
 
         DROP TABLE IF EXISTS "${temporaryTable}";
     </insert>
 
+    <insert id="differenceTableWkt">
+        CREATE TABLE "${newTableName}" AS
+        SELECT id, public.ST_Difference(inTbale.geom, public.st_geomfromewkt(#{ewkt})) AS geom
+        FROM "${tableName}" inTbale
+        WHERE 1=1
+        <if test="tableIds != null and tableIds.size() > 0">
+            AND inTbale.id::VARCHAR IN
+            <foreach collection="tableIds" item="tableId" open="(" close=")" separator=",">
+                #{tableId}
+            </foreach>
+        </if>
+        ;
+    </insert>
+
     <insert id="intersectionTableWkt">
         CREATE TABLE "${newTableName}" AS
         SELECT id, public.ST_Intersection(inTbale.geom, public.st_geomfromewkt(#{ewkt})) AS geom
@@ -62,4 +77,17 @@
         </if>
         ;
     </insert>
+    <insert id="intersectionTables">
+        CREATE TABLE "${newTableName}" AS
+        SELECT ta.id, public.ST_Intersection(ta.geom, tb.geom) AS geom
+        FROM "${tableNameA}" ta, "${tableNameB}" tb
+        WHERE public.ST_Intersects(ta.geom, tb.geom)
+        <if test="tableIdsA != null and tableIdsA.size() > 0">
+            AND ta.id::VARCHAR IN
+            <foreach collection="tableIdsA" item="tableId" open="(" close=")" separator=",">
+                #{tableId}
+            </foreach>
+        </if>
+        ;
+    </insert>
 </mapper>

+ 14 - 0
onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/TableDateMapper.xml

@@ -109,4 +109,18 @@
             </foreach>
         </if>
     </select>
+
+    <select id="getGeomUnion" resultType="String">
+        SELECT
+        public.st_asewkt(public.st_union(geom)) AS geom
+        FROM
+        "${tableName}"
+        <if test="tableIds != null and tableIds.size()>0 ">
+            WHERE
+            (id::varchar) IN
+            <foreach item="tableId" collection="tableIds" open="(" separator="," close=")">
+                #{tableId}
+            </foreach>
+        </if>
+    </select>
 </mapper>