| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417 |
- <?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>,
- 0
- )
- </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>,
- 0
- )
- </foreach>
- </insert>
- <insert id="batchInsertJzwShp">
- INSERT INTO vector.fw (
- objectid,
- bsm,
- ysdm,
- bdcdyh,
- zddm,
- xzqdm,
- zh,
- xmmc,
- jzwmc,
- jgrq,
- jzwgd,
- zzdmj,
- zydmj,
- ycjzmj,
- scjzmj,
- jzwjbyt,
- zcs,
- dscs,
- dxcs,
- dxsd,
- ghyt,
- fwjg,
- zts,
- bz,
- zt,
- tstybm,
- zrzh,
- lplb,
- zl,
- bgjzxx,
- bgtsxx,
- rkxh,
- rkr,
- rksj,
- ytmc,
- dah,
- srctable,
- from_id,
- to_id,
- projectid,
- shape_area,
- shape_len,
- geom
- )
- VALUES
- <foreach collection="list" item="item" separator=",">
- (
- #{item.objectid},
- #{item.bsm},
- #{item.ysdm},
- #{item.bdcdyh},
- #{item.zddm},
- #{item.xzqdm},
- #{item.zh},
- #{item.xmmc},
- #{item.jzwmc},
- #{item.jgrq},
- #{item.jzwgd},
- #{item.zzdmj},
- #{item.zydmj},
- #{item.ycjzmj},
- #{item.scjzmj},
- #{item.jzwjbyt},
- #{item.zcs},
- #{item.dscs},
- #{item.dxcs},
- #{item.dxsd},
- #{item.ghyt},
- #{item.fwjg},
- #{item.zts},
- #{item.bz},
- #{item.zt},
- #{item.tstybm},
- #{item.zrzh},
- #{item.lplb},
- #{item.zl},
- #{item.bgjzxx},
- #{item.bgtsxx},
- #{item.rkxh},
- #{item.rkr},
- #{item.rksj},
- #{item.ytmc},
- #{item.dah},
- #{item.srctable},
- #{item.from_id},
- #{item.to_id},
- #{item.projectid},
- #{item.shape_area},
- #{item.shape_len},
- <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>
- )
- </foreach>
- </insert>
- <insert id="batchInsertZdShp">
- INSERT INTO vector.zd_shp (
- objectid,bsm,ysdm,bdcdyh,zddm,zdtzm,zl,midw,
- zdmj,yt,dj,jg,qllx,qlxz,qlsdfs,rjl,jzmd,jzxg,
- zdszd,zdszn,zdszx,zdszb,tfh,djh,qlrmc,jzmj,jzwzdmj,
- zt,bhyy,bhnr,djsj,dbr,fj,tstybm,xzqdm,sjzdtybm,
- fzmj,ybzddm,jzlb,syqx,qsrq,zzrq,bgjzxx,bgtsxx,
- dah,rkxh,rkr,rksj,ytmc,zdt,bz,srctable,
- from_id,to_id,projectid,txzt,jdzt,ywh,bdcqzh,
- ydyhfl,shape_area,shape_len,geom
- )
- VALUES
- <foreach collection="list" item="item" separator=",">
- (
- #{item.objectid},
- #{item.bsm},
- #{item.ysdm},
- #{item.bdcdyh},
- #{item.zddm},
- #{item.zdtzm},
- #{item.zl},
- #{item.midw},
- #{item.zdmj},
- #{item.yt},
- #{item.dj},
- #{item.jg},
- #{item.qllx},
- #{item.qlxz},
- #{item.qlsdfs},
- #{item.rjl},
- #{item.jzmd},
- #{item.jzxg},
- #{item.zdszd},
- #{item.zdszn},
- #{item.zdszx},
- #{item.zdszb},
- #{item.tfh},
- #{item.djh},
- #{item.qlrmc},
- #{item.jzmj},
- #{item.jzwzdmj},
- #{item.zt},
- #{item.bhyy},
- #{item.bhnr},
- #{item.djsj},
- #{item.dbr},
- #{item.fj},
- #{item.tstybm},
- #{item.xzqdm},
- #{item.sjzdtybm},
- #{item.fzmj},
- #{item.ybzddm},
- #{item.jzlb},
- #{item.syqx},
- #{item.qsrq},
- #{item.zzrq},
- #{item.bgjzxx},
- #{item.bgtsxx},
- #{item.dah},
- #{item.rkxh},
- #{item.rkr},
- #{item.rksj},
- #{item.ytmc},
- #{item.zdt},
- #{item.bz},
- #{item.srctable},
- #{item.from_id},
- #{item.to_id},
- #{item.projectid},
- #{item.txzt},
- #{item.jdzt},
- #{item.ywh},
- #{item.bdcqzh},
- #{item.ydyhfl},
- #{item.shape_area},
- #{item.shape_len},
- <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>
- )
- </foreach>
- </insert>
- <insert id="insertTableData">
- INSERT INTO vector.${tableName} (
- <foreach collection="data" index="key" item="value" separator=",">
- ${key}
- </foreach>
- )
- VALUES (
- <foreach collection="data" index="key" item="value" separator=",">
- <choose>
- <!-- 判断 geom 是否为空,并进行转换 -->
- <when test="key == 'geom' and value != null">
- public.st_transform(public.st_geomfromewkt(#{value}), #{shpDbSRID})
- </when>
- <otherwise>
- #{value}
- </otherwise>
- </choose>
- </foreach>
- )
- </insert>
- <select id="selectTableDataAndGeom" resultType="Map">
- SELECT * ,public.st_asewkt(geom) AS geom2
- FROM vector.${tableName}
- WHERE 1=1
- </select>
- <select id="selectTableDjzq" resultType="Map">
- SELECT bsm, ysdm, djzqdm, djzqmc, bz, public.st_astext(geom) as wkt_geom, valid_flag FROM vector.djzq
- <where>
- <if test="ysdm != null and ysdm != ''"> and ysdm = #{ysdm}</if>
- <if test="validFlag != null"> and valid_flag = #{validFlag}</if>
- </where>
- LIMIT 1000
- </select>
- </mapper>
|