12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?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.apply.mapper.gdbh.TGdbhRwGeomMapper">
-
- <resultMap type="TGdbhRwGeom" id="TGdbhRwGeomResult">
- <result property="id" column="id" />
- <result property="geom" column="geom" />
- <result property="rwbsm" column="rwbsm" />
- <result property="geomJson" column="geom_json" />
- <result property="sort" column="sort" />
- <result property="geomarea" column="geomarea" />
- </resultMap>
- <sql id="selectTGdbhRwGeomVo">
- select id, geom, rwbsm, geom_json, sort, geomarea from t_gdbh_rw_geom
- </sql>
- <select id="selectTGdbhRwGeomList" parameterType="TGdbhRwGeom" resultMap="TGdbhRwGeomResult">
- <include refid="selectTGdbhRwGeomVo"/>
- <where>
- <if test="geom != null and geom != ''"> and geom = #{geom}</if>
- <if test="rwbsm != null and rwbsm != ''"> and rwbsm = #{rwbsm}</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 geomarea = #{geomarea}</if>
- </where>
- </select>
-
- <select id="selectTGdbhRwGeomById" parameterType="String" resultMap="TGdbhRwGeomResult">
- <include refid="selectTGdbhRwGeomVo"/>
- where id = #{id}
- </select>
- <select id="sumTGdbhRwGeomByRwbsm" parameterType="String" resultType="map">
- select public.st_asewkt(public.st_union(geom)) geom, sum(geomarea) geomarea, count(*) geomnumber,STRING_AGG(id, ',') AS ids from t_gdbh_rw_geom
- where rwbsm = #{rwbsm}
- </select>
- <insert id="insertTGdbhRwGeom" parameterType="TGdbhRwGeom">
- insert into t_gdbh_rw_geom
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null and id != ''">id,</if>
- <if test="geom != null">geom,</if>
- <if test="rwbsm != null and rwbsm != ''">rwbsm,</if>
- <if test="geomJson != null">geom_json,</if>
- <if test="sort != null">sort,</if>
- <if test="geomarea != null">geomarea,</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}), 4326),</if>
- <if test="rwbsm != null and rwbsm != ''">#{rwbsm},</if>
- <if test="geomJson != null">#{geomJson},</if>
- <if test="sort != null">#{sort},</if>
- <if test="geomarea != null">#{geomarea},</if>
- </trim>
- </insert>
- <update id="updateTGdbhRwGeom" parameterType="TGdbhRwGeom">
- update t_gdbh_rw_geom
- <trim prefix="SET" suffixOverrides=",">
- <if test="geom != null">geom = #{geom},</if>
- <if test="rwbsm != null and rwbsm != ''">rwbsm = #{rwbsm},</if>
- <if test="geomJson != null">geom_json = #{geomJson},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="geomarea != null">geomarea = #{geomarea},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteTGdbhRwGeomById" parameterType="String">
- delete from t_gdbh_rw_geom where id = #{id}
- </delete>
- <delete id="deleteTGdbhRwGeomByIds" parameterType="String">
- delete from t_gdbh_rw_geom where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|