<?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.TDkjbxxHcMapper">
    
    <resultMap type="TDkjbxxHc" id="TDkjbxxHcResult">
        <result property="id"    column="id"    />
        <result property="dkjbxxId"    column="dkjbxx_id"    />
        <result property="decide"    column="decide"    />
        <result property="dlbm"    column="dlbm"    />
        <result property="notes"    column="notes"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="dlmc"    column="dlmc"    />
        <result property="auditflowId"    column="auditflow_id"    />
        <result property="auditflowStep"    column="auditflow_step"    />
        <result property="sign"    column="sign"    />
        <result property="fieldworkId"    column="fieldwork_id"    />
    </resultMap>

    <sql id="selectTDkjbxxHcVo">
        select id, dkjbxx_id, decide, dlbm, notes, create_by, create_time, dlmc, auditflow_id, auditflow_step, sign,fieldwork_id from t_dkjbxx_hc
    </sql>

    <select id="selectTDkjbxxHcList" parameterType="TDkjbxxHc" resultMap="TDkjbxxHcResult">
        <include refid="selectTDkjbxxHcVo"/>
        <where>  
            <if test="dkjbxxId != null  and dkjbxxId != ''"> and dkjbxx_id = #{dkjbxxId}</if>
            <if test="decide != null  and decide != ''"> and decide = #{decide}</if>
            <if test="dlbm != null  and dlbm != ''"> and dlbm = #{dlbm}</if>
            <if test="notes != null  and notes != ''"> and notes = #{notes}</if>
            <if test="dlmc != null  and dlmc != ''"> and dlmc = #{dlmc}</if>
            <if test="auditflowId != null  and auditflowId != ''"> and auditflow_id = #{auditflowId}</if>
            <if test="auditflowStep != null  and auditflowStep != ''"> and auditflow_step = #{auditflowStep}</if>
            <if test="sign != null  and sign != ''"> and sign = #{sign}</if>
            <if test="fieldworkId != null and fieldworkId != ''"> and fieldwork_id=#{fieldworkId}</if>
        </where>
    </select>
    
    <select id="selectTDkjbxxHcById" parameterType="String" resultMap="TDkjbxxHcResult">
        <include refid="selectTDkjbxxHcVo"/>
        where id = #{id}
    </select>

    <insert id="insertTDkjbxxHc" parameterType="TDkjbxxHc">
        insert into t_dkjbxx_hc
        <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="dlbm != null">dlbm,</if>
            <if test="notes != null">notes,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="dlmc != null">dlmc,</if>
            <if test="auditflowId != null">auditflow_id,</if>
            <if test="auditflowStep != null">auditflow_step,</if>
            <if test="sign != null">sign,</if>
            <if test="fieldworkId != null and fieldworkId != ''">fieldwork_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="dlbm != null">#{dlbm},</if>
            <if test="notes != null">#{notes},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="dlmc != null">#{dlmc},</if>
            <if test="auditflowId != null">#{auditflowId},</if>
            <if test="auditflowStep != null">#{auditflowStep},</if>
            <if test="sign != null">#{sign},</if>
            <if test="fieldworkId != null and fieldworkId != ''">#{fieldworkId},</if>
         </trim>
    </insert>

    <update id="updateTDkjbxxHc" parameterType="TDkjbxxHc">
        update t_dkjbxx_hc
        <trim prefix="SET" suffixOverrides=",">
            <if test="dkjbxxId != null and dkjbxxId != ''">dkjbxx_id = #{dkjbxxId},</if>
            <if test="decide != null">decide = #{decide},</if>
            <if test="dlbm != null">dlbm = #{dlbm},</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="dlmc != null">dlmc = #{dlmc},</if>
            <if test="auditflowId != null">auditflow_id = #{auditflowId},</if>
            <if test="auditflowStep != null">auditflow_step = #{auditflowStep},</if>
            <if test="sign != null">sign = #{sign},</if>
            <if test="fieldworkId != null and fieldworkId != ''">fieldwork_id=#{fieldworkId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTDkjbxxHcById" parameterType="String">
        delete from t_dkjbxx_hc where id = #{id}
    </delete>

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