1234567891011121314151617181920212223242526272829 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.onemap.analyse.mapper.CreateUtilsDBMapper">
- <insert id="bufferTable">
- CREATE TABLE "${newTableName}" AS
- SELECT public.ST_Buffer(geom, #{radius}) AS buffered_geom
- FROM "${tableName}"
- WHERE geom IS NOT NULL
- </insert>
- <insert id="differenceTables">
- CREATE TABLE "${newTableName}" AS
- SELECT CASE
- WHEN b.geom IS NOT NULL THEN public.ST_Difference(a.geom, b.geom)
- ELSE a.geom END AS geom_result
- FROM "${tableNameB}" a
- LEFT JOIN "${tableNameA}" b ON public.ST_Intersects(a.geom, b.geom)
- WHERE
- b.geom IS NOT NULL
- <if test="tableIdsB != null and tableIdsB.size() > 0">
- AND a.id::VARCHAR IN
- <foreach collection="tableIdsB" item="tableId" open="(" close=")" separator=",">
- #{tableId}
- </foreach>
- </if>
- </insert>
- </mapper>
|