| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?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.siwei.spatial.mapper.file.TGeomDbDetailsMapper">
-
- <resultMap type="TGeomDbDetails" id="TGeomDbDetailsResult">
- <result property="id" column="id" />
- <result property="geom" column="geom" />
- <result property="uploadId" column="upload_id" />
- <result property="geomJson" column="geom_json" />
- <result property="sort" column="sort" />
- <result property="geomArea" column="geom_area" />
- </resultMap>
- <resultMap type="TGeomDb" id="TGeomDbResult">
- <result property="id" column="id" />
- <result property="name" column="name" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="shppath" column="shppath" />
- <result property="filetype" column="filetype" />
- <result property="geom" column="geom" />
- <result property="geomNumber" column="geom_number" />
- <result property="geomArea" column="geom_area" />
- <result property="fromroute" column="fromroute" />
- </resultMap>
- <sql id="selectTGeomDbDetailsVo">
- select id, public.st_asewkt(geom) AS geom, upload_id, geom_json, sort, geom_area from t_geom_db_details
- </sql>
- <select id="selectTGeomDbDetailsList" parameterType="TGeomDbDetails" resultMap="TGeomDbDetailsResult">
- <include refid="selectTGeomDbDetailsVo"/>
- <where>
- <if test="geom != null and geom != ''"> and geom = #{geom}</if>
- <if test="uploadId != null and uploadId != ''"> and upload_id = #{uploadId}</if>
- <if test="geomJson != null and geomJson != ''"> and geom_json = #{geomJson}</if>
- <if test="sort != null and sort != ''"> and sort = #{sort}</if>
- <if test="geomArea != null and geomArea != ''"> and geom_area = #{geomArea}</if>
- </where>
- </select>
-
- <select id="selectTGeomDbDetailsById" parameterType="String" resultMap="TGeomDbDetailsResult">
- <include refid="selectTGeomDbDetailsVo"/>
- where id = #{id}
- </select>
- <select id="selectTGeomDbDetailsByNodeId" parameterType="String" resultMap="TGeomDbDetailsResult">
- select details.id, public.st_asewkt(details.geom) AS geom, details.upload_id, details.geom_json, details.sort, details.geom_area
- from t_geom_db_details details
- INNER JOIN t_node_land node on node.geom_db_id=details.upload_id
- WHERE node.node_id =#{nodeId}
- </select>
- <insert id="insertTGeomDbDetails" parameterType="TGeomDbDetails">
- insert into t_geom_db_details
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null and id != ''">id,</if>
- <if test="geom != null">geom,</if>
- <if test="uploadId != null and uploadId != ''">upload_id,</if>
- <if test="geomJson != null">geom_json,</if>
- <if test="sort != null">sort,</if>
- <if test="geom != null">geom_area,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null and id != ''">#{id},</if>
- <if test="geom != null">public.st_transform(public.st_geomfromewkt(#{geom}), #{shpDbSRID}),</if>
- <if test="uploadId != null and uploadId != ''">#{uploadId},</if>
- <if test="geomJson != null">#{geomJson},</if>
- <if test="sort != null">#{sort},</if>
- <if test="geom != null">
- public.st_area(public.st_transform(public.st_geomfromewkt(#{geom}), #{shpAreaSRID})
- <if test="shpAreaGeography != null and shpAreaGeography==true ">::PUBLIC.geography</if>
- ),
- </if>
- </trim>
- </insert>
- <update id="updateTGeomDbDetails" parameterType="TGeomDbDetails">
- update t_geom_db_details
- <trim prefix="SET" suffixOverrides=",">
- <if test="geom != null">geom = #{geom},</if>
- <if test="uploadId != null and uploadId != ''">upload_id = #{uploadId},</if>
- <if test="geomJson != null">geom_json = #{geomJson},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="geomArea != null">geom_area = #{geomArea},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteTGeomDbDetailsById" parameterType="String">
- delete from t_geom_db_details where id = #{id}
- </delete>
- <delete id="deleteTGeomDbDetailsByIds" parameterType="String">
- delete from t_geom_db_details where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="sumGeomDetailsByUploadId" parameterType="String" resultMap="TGeomDbResult" >
- select public.st_asewkt(public.st_union(geom)) AS geom, count(*) geom_number, sum(geom_area) geom_area
- from t_geom_db_details where upload_id = #{id}
- </select>
- <insert id="batchInsertDjzq">
- INSERT INTO vector.djzq (bsm, ysdm, djzqdm, djzqmc, bz, geom, valid_flag)
- VALUES
- <foreach collection="list" item="item" separator=",">
- (
- #{item.bsm},
- #{item.ysdm},
- #{item.djzqdm},
- #{item.djzqmc},
- #{item.projectid},
- <choose>
- <when test="item.the_geom != null and item.the_geom != ''">
- public.st_transform(public.st_geomfromewkt(#{item.the_geom}), #{shpDbSRID})
- </when>
- <otherwise>
- null
- </otherwise>
- </choose>,
- 1
- )
- </foreach>
- </insert>
- <insert id="batchInsertDjq">
- INSERT INTO vector.djq (bsm, ysdm, djqdm, djqmc, bz, geom, valid_flag)
- VALUES
- <foreach collection="list" item="item" separator=",">
- (
- #{item.bsm},
- #{item.ysdm},
- #{item.djqdm},
- #{item.djqmc},
- #{item.projectid},
- <choose>
- <when test="item.the_geom != null and item.the_geom != ''">
- public.st_transform(public.st_geomfromewkt(#{item.the_geom}), #{shpDbSRID})
- </when>
- <otherwise>
- null
- </otherwise>
- </choose>,
- 1
- )
- </foreach>
- </insert>
- <select id="selectTableDataAndGeom" resultType="Map">
- SELECT * ,public.st_asewkt(geom) AS geom2
- FROM vector.${tableName}
- WHERE 1=1
- </select>
- </mapper>
|