|
@@ -0,0 +1,90 @@
|
|
|
+<?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.AnalyseUtilsDBMapper">
|
|
|
+
|
|
|
+ <select id="intersectsTableWkt" resultType="String">
|
|
|
+ SELECT id
|
|
|
+ FROM "${inputTable}" inTbale
|
|
|
+ where public.st_intersects(
|
|
|
+ <choose>
|
|
|
+ <when test="intersectsWktSRID != null and intersectsWktSRID !=''">
|
|
|
+ public.st_setsrid(public.st_geomfromewkt(#{intersectsWkt}),#{intersectsWktSRID}),
|
|
|
+ public.st_transform(
|
|
|
+ <choose>
|
|
|
+ <when test="inputSRID != null and inputSRID !=''">
|
|
|
+ public.st_setsrid(inTbale.geom,#{inputSRID})
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ inTbale.geom
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ ,#{intersectsWktSRID}
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ public.st_geomfromewkt(#{intersectsWkt}),
|
|
|
+ <choose>
|
|
|
+ <when test="inputSRID != null and inputSRID !=''">
|
|
|
+ public.st_setsrid(inTbale.geom,#{inputSRID})
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ inTbale.geom
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ )
|
|
|
+ <if test="inputIds != null and inputIds.size()>0 ">
|
|
|
+ and (inTbale.id)::VARCHAR in
|
|
|
+ <foreach collection="inputIds" item="id" open="(" close=")" separator=",">#{id}</foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="intersectionTableWkt" resultType="map">
|
|
|
+ SELECT ret_tab.id,ret_tab.ret_geom_vv geom,public.st_area(ret_tab.ret_geom_vv) geom_area
|
|
|
+ <if test="outputColumn != null and outputColumn.size()>0 ">
|
|
|
+ <foreach collection="outputColumn" item="columnValue" open="," separator=",">
|
|
|
+ "${columnValue}"
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ FROM ( SELECT inTbale.*,
|
|
|
+ public.st_intersection(
|
|
|
+ <choose>
|
|
|
+ <when test="intersectionWktSRID != null and intersectionWktSRID !=''">
|
|
|
+ public.st_setsrid(public.st_geomfromewkt(#{intersectionWkt}),#{intersectionWktSRID}),
|
|
|
+ public.st_transform(
|
|
|
+ <choose>
|
|
|
+ <when test="inputSRID != null and inputSRID !=''">
|
|
|
+ public.st_setsrid(inTbale.geom,#{inputSRID})
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ inTbale.geom
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ ,#{intersectionWktSRID}
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ public.st_geomfromewkt(#{intersectionWkt}),
|
|
|
+ <choose>
|
|
|
+ <when test="inputSRID != null and inputSRID !=''">
|
|
|
+ public.st_setsrid(inTbale.geom,#{inputSRID})
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ inTbale.geom
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ ) ret_geom_vv
|
|
|
+ FROM "${inputTable}" inTbale
|
|
|
+ <if test="inputIds != null and inputIds.size()>0 ">
|
|
|
+ where (inTbale.id)::VARCHAR in
|
|
|
+ <foreach collection="inputIds" item="id" open="(" close=")" separator=",">#{id}</foreach>
|
|
|
+ </if>
|
|
|
+ )ret_tab
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|