|
@@ -124,7 +124,7 @@
|
|
|
)
|
|
|
</select>
|
|
|
|
|
|
- <select id="distanceTableWkt" resultType="String">
|
|
|
+ <select id="distanceTableWkt" resultType="Integer">
|
|
|
SELECT id
|
|
|
FROM "${tableName}" inTbale
|
|
|
where public.st_distance(
|
|
@@ -136,15 +136,20 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
- <select id="distanceTables" resultType="String">
|
|
|
+ <select id="distanceTables" resultType="Integer">
|
|
|
SELECT id
|
|
|
- FROM "${tableName}" inTbale
|
|
|
- where public.st_distance(
|
|
|
- inTbale.geom::public.geography,
|
|
|
- public.st_geomfromewkt(#{ewkt})::public.geography) < #{distance}
|
|
|
- <if test="inputIds != null and inputIds.size()>0 ">
|
|
|
- and (inTbale.id)::VARCHAR in
|
|
|
- <foreach collection="inputIds" item="id" open="(" close=")" separator=",">#{id}</foreach>
|
|
|
+ FROM "${tableNameB}" tableB
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="tableIdsB != null and tableIdsB.size()>0 ">
|
|
|
+ and (tableB.id)::VARCHAR in
|
|
|
+ <foreach collection="tableIdsB" item="tableId" open="(" close=")" separator=",">#{tableId}</foreach>
|
|
|
</if>
|
|
|
+ AND EXISTS (
|
|
|
+ SELECT 1
|
|
|
+ FROM "${tableNameA}" as tableA
|
|
|
+ WHERE public.ST_DWithin(
|
|
|
+ tableA.geom::public.geography,
|
|
|
+ tableB.geom::public.geography,#{distance})
|
|
|
+ )
|
|
|
</select>
|
|
|
</mapper>
|