<?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.rsmonitoring.mapper.TDkjbxxYwypMapper">
    
    <resultMap type="TDkjbxxYwyp" id="TDkjbxxYwypResult">
        <result property="id"    column="id"    />
        <result property="geom"    column="geom"    />
        <result property="dkbh"    column="dkbh"    />
        <result property="dkmj"    column="dkmj"    />
        <result property="xzqdm"    column="xzqdm"    />
        <result property="xzqmc"    column="xzqmc"    />
        <result property="qlx"    column="qlx"    />
        <result property="hlx"    column="hlx"    />
        <result property="qsx"    column="qsx"    />
        <result property="hsx"    column="hsx"    />
        <result property="lzb"    column="lzb"    />
        <result property="bzb"    column="bzb"    />
        <result property="shpJson"    column="shp_json"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="qsxtif"    column="qsxtif"    />
        <result property="hsxtif"    column="hsxtif"    />
        <result property="checkUpdate"    column="check_update"    />
        <result property="hfx"    column="hfx"    />
        <result property="hfx1"    column="hfx1"    />
        <result property="mj"    column="mj"    />
        <result property="mjj"    column="mjj"    />
        <result property="bhj"    column="bhj"    />
        <result property="sheetJson"    column="sheet_json"    />
        <result property="yjjbntmj"    column="yjjbntmj"    />
        <result property="gdmj"    column="gdmj"    />
    </resultMap>

    <sql id="selectTDkjbxxYwypVo">
        select id, public.st_asewkt(geom) geom, dkbh, dkmj, xzqdm, xzqmc, qlx, hlx, qsx, hsx, lzb, bzb, shp_json, create_by, create_time,
               qsxtif, hsxtif, check_update, hfx, hfx1, mj, mjj, bhj, sheet_json,yjjbntmj,gdmj from t_dkjbxx_ywyp
    </sql>

    <select id="selectTDkjbxxYwypList" parameterType="TDkjbxxYwyp" resultMap="TDkjbxxYwypResult">
        <include refid="selectTDkjbxxYwypVo"/>
        <where>  
            <if test="geom != null  and geom != ''"> and geom = #{geom}</if>
            <if test="dkbh != null  and dkbh != ''"> and dkbh = #{dkbh}</if>
            <if test="dkmj != null  and dkmj != ''"> and dkmj = #{dkmj}</if>
            <if test="xzqdm != null  and xzqdm != ''"> and xzqdm = #{xzqdm}</if>
            <if test="xzqmc != null  and xzqmc != ''"> and xzqmc = #{xzqmc}</if>
            <if test="qlx != null  and qlx != ''"> and qlx = #{qlx}</if>
            <if test="hlx != null  and hlx != ''"> and hlx = #{hlx}</if>
            <if test="qsx != null  and qsx != ''"> and qsx = #{qsx}</if>
            <if test="hsx != null  and hsx != ''"> and hsx = #{hsx}</if>
            <if test="lzb != null  and lzb != ''"> and lzb = #{lzb}</if>
            <if test="bzb != null  and bzb != ''"> and bzb = #{bzb}</if>
            <if test="shpJson != null  and shpJson != ''"> and shp_json = #{shpJson}</if>
            <if test="qsxtif != null  and qsxtif != ''"> and qsxtif = #{qsxtif}</if>
            <if test="hsxtif != null  and hsxtif != ''"> and hsxtif = #{hsxtif}</if>
            <if test="checkUpdate != null  and checkUpdate != ''"> and check_update = #{checkUpdate}</if>
            <if test="hfx != null  and hfx != ''"> and hfx = #{hfx}</if>
            <if test="hfx1 != null  and hfx1 != ''"> and hfx1 = #{hfx1}</if>
            <if test="mj != null  and mj != ''"> and mj = #{mj}</if>
            <if test="mjj != null  and mjj != ''"> and mjj = #{mjj}</if>
            <if test="bhj != null  and bhj != ''"> and bhj = #{bhj}</if>
            <if test="sheetJson != null  and sheetJson != ''"> and sheet_json = #{sheetJson}</if>
        </where>
    </select>
    
    <select id="selectTDkjbxxYwypById" parameterType="String" resultMap="TDkjbxxYwypResult">
        <include refid="selectTDkjbxxYwypVo"/>
        where id = #{id}
    </select>

    <select id="selectTDkjbxxYwypByDkbh" parameterType="String" resultMap="TDkjbxxYwypResult">
        <include refid="selectTDkjbxxYwypVo"/>
        where dkbh = #{dkbh}
    </select>

    <insert id="insertTDkjbxxYwyp" parameterType="TDkjbxxYwyp">
        insert into t_dkjbxx_ywyp
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">id,</if>
            <if test="geom != null">geom,</if>
            <if test="dkbh != null and dkbh != ''">dkbh,</if>
            <if test="dkmj != null">dkmj,</if>
            <if test="xzqdm != null">xzqdm,</if>
            <if test="xzqmc != null">xzqmc,</if>
            <if test="qlx != null">qlx,</if>
            <if test="hlx != null">hlx,</if>
            <if test="qsx != null">qsx,</if>
            <if test="hsx != null">hsx,</if>
            <if test="lzb != null">lzb,</if>
            <if test="bzb != null">bzb,</if>
            <if test="shpJson != null">shp_json,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="qsxtif != null">qsxtif,</if>
            <if test="hsxtif != null">hsxtif,</if>
            <if test="checkUpdate != null">check_update,</if>
            <if test="hfx != null">hfx,</if>
            <if test="hfx1 != null">hfx1,</if>
            <if test="mj != null">mj,</if>
            <if test="mjj != null">mjj,</if>
            <if test="bhj != null">bhj,</if>
            <if test="sheetJson != null">sheet_json,</if>
            <if test="yjjbntmj != null  and yjjbntmj != ''">yjjbntmj,</if>
            <if test="gdmj != null  and gdmj != ''">gdmj,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">#{id},</if>
            <if test="geom != null">public.st_geomfromewkt(#{geom}),</if>
            <if test="dkbh != null and dkbh != ''">#{dkbh},</if>
            <if test="dkmj != null">#{dkmj},</if>
            <if test="xzqdm != null">#{xzqdm},</if>
            <if test="xzqmc != null">#{xzqmc},</if>
            <if test="qlx != null">#{qlx},</if>
            <if test="hlx != null">#{hlx},</if>
            <if test="qsx != null">#{qsx},</if>
            <if test="hsx != null">#{hsx},</if>
            <if test="lzb != null">#{lzb},</if>
            <if test="bzb != null">#{bzb},</if>
            <if test="shpJson != null">#{shpJson},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="qsxtif != null">#{qsxtif},</if>
            <if test="hsxtif != null">#{hsxtif},</if>
            <if test="checkUpdate != null">#{checkUpdate},</if>
            <if test="hfx != null">#{hfx},</if>
            <if test="hfx1 != null">#{hfx1},</if>
            <if test="mj != null">#{mj},</if>
            <if test="mjj != null">#{mjj},</if>
            <if test="bhj != null">#{bhj},</if>
            <if test="sheetJson != null">#{sheetJson},</if>
            <if test="yjjbntmj != null  and yjjbntmj != ''">#{yjjbntmj},</if>
            <if test="gdmj != null  and gdmj != ''">#{gdmj},</if>
         </trim>
    </insert>

    <update id="updateTDkjbxxYwyp" parameterType="TDkjbxxYwyp">
        update t_dkjbxx_ywyp
        <trim prefix="SET" suffixOverrides=",">
            <if test="geom != null">geom = public.st_geomfromewkt(#{geom}),</if>
            <if test="dkbh != null and dkbh != ''">dkbh = #{dkbh},</if>
            <if test="dkmj != null">dkmj = #{dkmj},</if>
            <if test="xzqdm != null">xzqdm = #{xzqdm},</if>
            <if test="xzqmc != null">xzqmc = #{xzqmc},</if>
            <if test="qlx != null">qlx = #{qlx},</if>
            <if test="hlx != null">hlx = #{hlx},</if>
            <if test="qsx != null">qsx = #{qsx},</if>
            <if test="hsx != null">hsx = #{hsx},</if>
            <if test="lzb != null">lzb = #{lzb},</if>
            <if test="bzb != null">bzb = #{bzb},</if>
            <if test="shpJson != null">shp_json = #{shpJson},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="qsxtif != null">qsxtif = #{qsxtif},</if>
            <if test="hsxtif != null">hsxtif = #{hsxtif},</if>
            <if test="checkUpdate != null">check_update = #{checkUpdate},</if>
            <if test="hfx != null">hfx = #{hfx},</if>
            <if test="hfx1 != null">hfx1 = #{hfx1},</if>
            <if test="mj != null">mj = #{mj},</if>
            <if test="mjj != null">mjj = #{mjj},</if>
            <if test="bhj != null">bhj = #{bhj},</if>
            <if test="sheetJson != null">sheet_json = #{sheetJson},</if>
            <if test="yjjbntmj != null  and yjjbntmj != ''">yjjbntmj = #{yjjbntmj}</if>
            <if test="gdmj != null  and gdmj != ''">gdmj = #{gdmj}</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTDkjbxxYwypById" parameterType="String">
        delete from t_dkjbxx_ywyp where id = #{id}
    </delete>

    <delete id="deleteTDkjbxxYwypByIds" parameterType="String">
        delete from t_dkjbxx_ywyp where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>