<?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.sooka.system.mapper.TgjjDbxxMapper">
    
    <resultMap type="TgjjDbxx" id="TgjjDbxxResult">
        <result property="ID"    column="ID"    />
        <result property="DBHTBH"    column="DBHTBH"    />
        <result property="JKHTBH"    column="JKHTBH"    />
        <result property="DBJGMC"    column="DBJGMC"    />
        <result property="DYWQZH"    column="DYWQZH"    />
        <result property="DYWTXQZH"    column="DYWTXQZH"    />
        <result property="DYWFWZL"    column="DYWFWZL"    />
        <result property="DYQJLRQ"    column="DYQJLRQ"    />
        <result property="DYQJCRQ"    column="DYQJCRQ"    />
        <result property="DYWPGJZ"    column="DYWPGJZ"    />
        <result property="BZHTBH"    column="BZHTBH"    />
        <result property="BZJGMC"    column="BZJGMC"    />
        <result property="DKBZJ"    column="DKBZJ"    />
        <result property="ZYHTBH"    column="ZYHTBH"    />
        <result property="ZYWBH"    column="ZYWBH"    />
        <result property="ZYWMC"    column="ZYWMC"    />
        <result property="ZYWJZ"    column="ZYWJZ"    />
        <result property="ZYHTKSRQ"    column="ZYHTKSRQ"    />
        <result property="ZYHTJSRQ"    column="ZYHTJSRQ"    />
        <result property="ZXBH"    column="ZXBH"    />
        <result property="lastUpdateTime"    column="LAST_UPDATE_TIME"    />
        <result property="DYFWGFHTH"    column="DYFWGFHTH"    />
        <result property="CLLX"    column="CLLX"    />
    </resultMap>

    <sql id="selectTgjjDbxxVo">
        select ID, DBHTBH, JKHTBH, DBJGMC, DYWQZH, DYWTXQZH, DYWFWZL, DYQJLRQ, DYQJCRQ, DYWPGJZ, BZHTBH, BZJGMC, DKBZJ, ZYHTBH, ZYWBH, ZYWMC, ZYWJZ, ZYHTKSRQ, ZYHTJSRQ, ZXBH, LAST_UPDATE_TIME, DYFWGFHTH, CLLX from tgjj_dbxx
    </sql>

    <select id="selectTgjjDbxxList" parameterType="TgjjDbxx" resultMap="TgjjDbxxResult">
        <include refid="selectTgjjDbxxVo"/>
        <where>  
            <if test="DBHTBH != null  and DBHTBH != ''"> and DBHTBH = #{DBHTBH}</if>
            <if test="JKHTBH != null  and JKHTBH != ''"> and JKHTBH = #{JKHTBH}</if>
            <if test="DBJGMC != null  and DBJGMC != ''"> and DBJGMC = #{DBJGMC}</if>
            <if test="DYWQZH != null  and DYWQZH != ''"> and DYWQZH = #{DYWQZH}</if>
            <if test="DYWTXQZH != null  and DYWTXQZH != ''"> and DYWTXQZH = #{DYWTXQZH}</if>
            <if test="DYWFWZL != null  and DYWFWZL != ''"> and DYWFWZL = #{DYWFWZL}</if>
            <if test="DYQJLRQ != null "> and DYQJLRQ = #{DYQJLRQ}</if>
            <if test="DYQJCRQ != null "> and DYQJCRQ = #{DYQJCRQ}</if>
            <if test="DYWPGJZ != null "> and DYWPGJZ = #{DYWPGJZ}</if>
            <if test="BZHTBH != null  and BZHTBH != ''"> and BZHTBH = #{BZHTBH}</if>
            <if test="BZJGMC != null  and BZJGMC != ''"> and BZJGMC = #{BZJGMC}</if>
            <if test="DKBZJ != null "> and DKBZJ = #{DKBZJ}</if>
            <if test="ZYHTBH != null  and ZYHTBH != ''"> and ZYHTBH = #{ZYHTBH}</if>
            <if test="ZYWBH != null  and ZYWBH != ''"> and ZYWBH = #{ZYWBH}</if>
            <if test="ZYWMC != null  and ZYWMC != ''"> and ZYWMC = #{ZYWMC}</if>
            <if test="ZYWJZ != null "> and ZYWJZ = #{ZYWJZ}</if>
            <if test="ZYHTKSRQ != null "> and ZYHTKSRQ = #{ZYHTKSRQ}</if>
            <if test="ZYHTJSRQ != null "> and ZYHTJSRQ = #{ZYHTJSRQ}</if>
            <if test="ZXBH != null  and ZXBH != ''"> and ZXBH = #{ZXBH}</if>
            <if test="lastUpdateTime != null "> and LAST_UPDATE_TIME = #{lastUpdateTime}</if>
            <if test="DYFWGFHTH != null  and DYFWGFHTH != ''"> and DYFWGFHTH = #{DYFWGFHTH}</if>
            <if test="CLLX != null "> and CLLX = #{CLLX}</if>
        </where>
        order by LAST_UPDATE_TIME DESC
    </select>
    
    <select id="selectTgjjDbxxById" parameterType="Long" resultMap="TgjjDbxxResult">
        <include refid="selectTgjjDbxxVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTgjjDbxx" parameterType="TgjjDbxx" useGeneratedKeys="true" keyProperty="ID">
        insert into tgjj_dbxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="DBHTBH != null">DBHTBH,</if>
            <if test="JKHTBH != null">JKHTBH,</if>
            <if test="DBJGMC != null">DBJGMC,</if>
            <if test="DYWQZH != null">DYWQZH,</if>
            <if test="DYWTXQZH != null">DYWTXQZH,</if>
            <if test="DYWFWZL != null">DYWFWZL,</if>
            <if test="DYQJLRQ != null">DYQJLRQ,</if>
            <if test="DYQJCRQ != null">DYQJCRQ,</if>
            <if test="DYWPGJZ != null">DYWPGJZ,</if>
            <if test="BZHTBH != null">BZHTBH,</if>
            <if test="BZJGMC != null">BZJGMC,</if>
            <if test="DKBZJ != null">DKBZJ,</if>
            <if test="ZYHTBH != null">ZYHTBH,</if>
            <if test="ZYWBH != null">ZYWBH,</if>
            <if test="ZYWMC != null">ZYWMC,</if>
            <if test="ZYWJZ != null">ZYWJZ,</if>
            <if test="ZYHTKSRQ != null">ZYHTKSRQ,</if>
            <if test="ZYHTJSRQ != null">ZYHTJSRQ,</if>
            <if test="ZXBH != null">ZXBH,</if>
            <if test="lastUpdateTime != null">LAST_UPDATE_TIME,</if>
            <if test="DYFWGFHTH != null">DYFWGFHTH,</if>
            <if test="CLLX != null">CLLX,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="DBHTBH != null">#{DBHTBH},</if>
            <if test="JKHTBH != null">#{JKHTBH},</if>
            <if test="DBJGMC != null">#{DBJGMC},</if>
            <if test="DYWQZH != null">#{DYWQZH},</if>
            <if test="DYWTXQZH != null">#{DYWTXQZH},</if>
            <if test="DYWFWZL != null">#{DYWFWZL},</if>
            <if test="DYQJLRQ != null">#{DYQJLRQ},</if>
            <if test="DYQJCRQ != null">#{DYQJCRQ},</if>
            <if test="DYWPGJZ != null">#{DYWPGJZ},</if>
            <if test="BZHTBH != null">#{BZHTBH},</if>
            <if test="BZJGMC != null">#{BZJGMC},</if>
            <if test="DKBZJ != null">#{DKBZJ},</if>
            <if test="ZYHTBH != null">#{ZYHTBH},</if>
            <if test="ZYWBH != null">#{ZYWBH},</if>
            <if test="ZYWMC != null">#{ZYWMC},</if>
            <if test="ZYWJZ != null">#{ZYWJZ},</if>
            <if test="ZYHTKSRQ != null">#{ZYHTKSRQ},</if>
            <if test="ZYHTJSRQ != null">#{ZYHTJSRQ},</if>
            <if test="ZXBH != null">#{ZXBH},</if>
            <if test="lastUpdateTime != null">#{lastUpdateTime},</if>
            <if test="DYFWGFHTH != null">#{DYFWGFHTH},</if>
            <if test="CLLX != null">#{CLLX},</if>
         </trim>
    </insert>

    <update id="updateTgjjDbxx" parameterType="TgjjDbxx">
        update tgjj_dbxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="DBHTBH != null">DBHTBH = #{DBHTBH},</if>
            <if test="JKHTBH != null">JKHTBH = #{JKHTBH},</if>
            <if test="DBJGMC != null">DBJGMC = #{DBJGMC},</if>
            <if test="DYWQZH != null">DYWQZH = #{DYWQZH},</if>
            <if test="DYWTXQZH != null">DYWTXQZH = #{DYWTXQZH},</if>
            <if test="DYWFWZL != null">DYWFWZL = #{DYWFWZL},</if>
            <if test="DYQJLRQ != null">DYQJLRQ = #{DYQJLRQ},</if>
            <if test="DYQJCRQ != null">DYQJCRQ = #{DYQJCRQ},</if>
            <if test="DYWPGJZ != null">DYWPGJZ = #{DYWPGJZ},</if>
            <if test="BZHTBH != null">BZHTBH = #{BZHTBH},</if>
            <if test="BZJGMC != null">BZJGMC = #{BZJGMC},</if>
            <if test="DKBZJ != null">DKBZJ = #{DKBZJ},</if>
            <if test="ZYHTBH != null">ZYHTBH = #{ZYHTBH},</if>
            <if test="ZYWBH != null">ZYWBH = #{ZYWBH},</if>
            <if test="ZYWMC != null">ZYWMC = #{ZYWMC},</if>
            <if test="ZYWJZ != null">ZYWJZ = #{ZYWJZ},</if>
            <if test="ZYHTKSRQ != null">ZYHTKSRQ = #{ZYHTKSRQ},</if>
            <if test="ZYHTJSRQ != null">ZYHTJSRQ = #{ZYHTJSRQ},</if>
            <if test="ZXBH != null">ZXBH = #{ZXBH},</if>
            <if test="lastUpdateTime != null">LAST_UPDATE_TIME = #{lastUpdateTime},</if>
            <if test="DYFWGFHTH != null">DYFWGFHTH = #{DYFWGFHTH},</if>
            <if test="CLLX != null">CLLX = #{CLLX},</if>
        </trim>
        where ID = #{ID}
    </update>

    <delete id="deleteTgjjDbxxById" parameterType="Long">
        delete from tgjj_dbxx where ID = #{ID}
    </delete>

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

</mapper>