<?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.TDkjbxxHgxMapper">
    
    <resultMap type="TDkjbxxHgx" id="TDkjbxxHgxResult">
        <result property="id"    column="id"    />
        <result property="dkjbxxId"    column="dkjbxx_id"    />
        <result property="decide"    column="decide"    />
        <result property="decideType"    column="decide_type"    />
        <result property="notes"    column="notes"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="geom"    column="geom"    />
        <result property="area"    column="area"    />
        <result property="auditflowId"    column="auditflow_id"    />
        <result property="recordId"    column="record_id"    />
    </resultMap>

    <sql id="selectTDkjbxxHgxVo">
        select id, dkjbxx_id, decide, decide_type, notes, create_by, create_time,geom,area,auditflow_id,record_id from t_dkjbxx_hgx
    </sql>

    <select id="selectTDkjbxxHgxList" parameterType="TDkjbxxHgx" resultMap="TDkjbxxHgxResult">
        <include refid="selectTDkjbxxHgxVo"/>
        <where>  
            <if test="dkjbxxId != null  and dkjbxxId != ''"> and dkjbxx_id = #{dkjbxxId}</if>
            <if test="decide != null  and decide != ''"> and decide = #{decide}</if>
            <if test="decideType != null  and decideType != ''"> and decide_type = #{decideType}</if>
            <if test="notes != null  and notes != ''"> and notes = #{notes}</if>
            <if test="auditflowId != null  and auditflowId != ''"> and auditflow_id = #{auditflowId}</if>
            <if test="recordId != null  and recordId != ''"> and record_id = #{recordId}</if>
        </where>
    </select>
    
    <select id="selectTDkjbxxHgxById" parameterType="String" resultMap="TDkjbxxHgxResult">
        <include refid="selectTDkjbxxHgxVo"/>
        where id = #{id}
    </select>

    <insert id="insertTDkjbxxHgx" parameterType="TDkjbxxHgx">
        insert into t_dkjbxx_hgx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">id,</if>
            <if test="dkjbxxId != null and dkjbxxId != ''">dkjbxx_id,</if>
            <if test="decide != null">decide,</if>
            <if test="decideType != null">decide_type,</if>
            <if test="notes != null">notes,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="geom != null">geom,</if>
            <if test="area != null">area,</if>
            <if test="auditflowId != null  and auditflowId != ''">auditflow_id,</if>
            <if test="recordId != null  and recordId != ''">record_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">#{id},</if>
            <if test="dkjbxxId != null and dkjbxxId != ''">#{dkjbxxId},</if>
            <if test="decide != null">#{decide},</if>
            <if test="decideType != null">#{decideType},</if>
            <if test="notes != null">#{notes},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="geom != null and geom!='' ">#{geom},</if>
            <if test="area != null and area!='' ">#{area},</if>
            <if test="auditflowId != null  and auditflowId != ''">#{auditflowId},</if>
            <if test="recordId != null  and recordId != ''">#{recordId},</if>
         </trim>
    </insert>

    <update id="updateTDkjbxxHgx" parameterType="TDkjbxxHgx">
        update t_dkjbxx_hgx
        <trim prefix="SET" suffixOverrides=",">
            <if test="dkjbxxId != null and dkjbxxId != ''">dkjbxx_id = #{dkjbxxId},</if>
            <if test="decide != null">decide = #{decide},</if>
            <if test="decideType != null">decide_type = #{decideType},</if>
            <if test="notes != null">notes = #{notes},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="geom != null and geom!=''">geom = #{geom},</if>
            <if test="area != null and area!=''">area = #{area},</if>
            <if test="auditflowId != null  and auditflowId != ''">auditflow_id = #{auditflowId},</if>
            <if test="recordId != null  and recordId != ''">record_id = #{recordId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTDkjbxxHgxById" parameterType="String">
        delete from t_dkjbxx_hgx where id = #{id}
    </delete>

    <delete id="deleteTDkjbxxHgxByDkjbxxId" parameterType="String">
        delete from t_dkjbxx_hgx where dkjbxx_id = #{dkjbxxId}
    </delete>

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