|
@@ -31,37 +31,33 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getTargetTable" resultType="Map">
|
|
|
- DROP TABLE IF EXISTS "${temporaryTable}";
|
|
|
-
|
|
|
- CREATE TABLE "${temporaryTable}" AS SELECT
|
|
|
- public.ST_Union ( b.geom ) AS geomRes
|
|
|
- FROM
|
|
|
- "${tableNameA}" a,
|
|
|
- "${tableNameB}" b
|
|
|
- WHERE
|
|
|
- public.st_intersects ( a.geom, b.geom )
|
|
|
- <if test="tableIdsA != null and tableIdsA.size() > 0">
|
|
|
- AND a.id IN
|
|
|
- <foreach collection="tableIdsA" item="tableId" open="(" close=")" separator=",">
|
|
|
- #{tableId}
|
|
|
- </foreach>
|
|
|
+ SELECT
|
|
|
+ <foreach item="column" collection="columns" separator=",">
|
|
|
+ <choose>
|
|
|
+ <when test="column == 'geom'">
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ a.${column}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </foreach>
|
|
|
+ <if test="columns != null and !columns.isEmpty()">
|
|
|
+ ,
|
|
|
</if>
|
|
|
- ;
|
|
|
-
|
|
|
- CREATE TABLE "${newTableName}" AS
|
|
|
- SELECT a.id,public.ST_Difference ( a.geom, b.geomRes ) AS geom
|
|
|
- FROM
|
|
|
- "${tableNameA}" a,
|
|
|
- "${temporaryTable}" b
|
|
|
- WHERE 1=1
|
|
|
- <if test="tableIdsA != null and tableIdsA.size() > 0">
|
|
|
- AND a.id IN
|
|
|
- <foreach collection="tableIdsA" item="tableId" open="(" close=")" separator=",">
|
|
|
- #{tableId}
|
|
|
- </foreach>
|
|
|
+ public.st_asewkt(b.geom) AS geom
|
|
|
+ <if test="siweiArea == true">
|
|
|
+ , public.st_area(b.geom::public.geography) AS siweiArea
|
|
|
</if>
|
|
|
- ;
|
|
|
-
|
|
|
- DROP TABLE IF EXISTS "${temporaryTable}";
|
|
|
+ FROM
|
|
|
+ "${rawTableName}" a
|
|
|
+ JOIN
|
|
|
+ "${targetTableName}" b
|
|
|
+ ON a.id = b.id
|
|
|
+ WHERE
|
|
|
+ a.id IN
|
|
|
+ <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
</select>
|
|
|
+
|
|
|
</mapper>
|