<?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.TgjjBsxxMapper">
    
    <resultMap type="TgjjBsxx" id="TgjjBsxxResult">
        <result property="ID"    column="ID"    />
        <result property="JKHTBH"    column="JKHTBH"    />
        <result property="JKRXM"    column="JKRXM"    />
        <result property="JKRZJLX"    column="JKRZJLX"    />
        <result property="JKRZJH"    column="JKRZJH"    />
        <result property="SFST"    column="SFST"    />
        <result property="SFSB"    column="SFSB"    />
        <result property="DKLX"    column="DKLX"    />
        <result property="YDFKRQ"    column="YDFKRQ"    />
        <result property="YDDQRQ"    column="YDDQRQ"    />
        <result property="DKKHRQ"    column="DKKHRQ"    />
        <result property="SCHKRQ"    column="SCHKRQ"    />
        <result property="DKZT"    column="DKZT"    />
        <result property="DKJQRQ"    column="DKJQRQ"    />
        <result property="ZXBH"    column="ZXBH"    />
        <result property="lastUpdateTime"    column="LAST_UPDATE_TIME"    />
        <result property="CLLX"    column="CLLX"    />
    </resultMap>

    <sql id="selectTgjjBsxxVo">
        select ID, JKHTBH, JKRXM, JKRZJLX, JKRZJH, SFST, SFSB, DKLX, YDFKRQ, YDDQRQ, DKKHRQ, SCHKRQ, DKZT, DKJQRQ, ZXBH, LAST_UPDATE_TIME, CLLX from tgjj_bsxx
    </sql>

    <select id="selectTgjjBsxxList" parameterType="TgjjBsxx" resultMap="TgjjBsxxResult">
        <include refid="selectTgjjBsxxVo"/>
        <where>  
            <if test="JKHTBH != null  and JKHTBH != ''"> and JKHTBH = #{JKHTBH}</if>
            <if test="JKRXM != null  and JKRXM != ''"> and JKRXM = #{JKRXM}</if>
            <if test="JKRZJLX != null  and JKRZJLX != ''"> and JKRZJLX = #{JKRZJLX}</if>
            <if test="JKRZJH != null  and JKRZJH != ''"> and JKRZJH = #{JKRZJH}</if>
            <if test="SFST != null  and SFST != ''"> and SFST = #{SFST}</if>
            <if test="SFSB != null  and SFSB != ''"> and SFSB = #{SFSB}</if>
            <if test="DKLX != null  and DKLX != ''"> and DKLX = #{DKLX}</if>
            <if test="YDFKRQ != null "> and YDFKRQ = #{YDFKRQ}</if>
            <if test="YDDQRQ != null "> and YDDQRQ = #{YDDQRQ}</if>
            <if test="DKKHRQ != null "> and DKKHRQ = #{DKKHRQ}</if>
            <if test="SCHKRQ != null "> and SCHKRQ = #{SCHKRQ}</if>
            <if test="DKZT != null  and DKZT != ''"> and DKZT = #{DKZT}</if>
            <if test="DKJQRQ != null "> and DKJQRQ = #{DKJQRQ}</if>
            <if test="ZXBH != null  and ZXBH != ''"> and ZXBH = #{ZXBH}</if>
            <if test="lastUpdateTime != null "> and LAST_UPDATE_TIME = #{lastUpdateTime}</if>
            <if test="CLLX != null "> and CLLX = #{CLLX}</if>
        </where>
        order by LAST_UPDATE_TIME DESC
    </select>
    
    <select id="selectTgjjBsxxById" parameterType="Long" resultMap="TgjjBsxxResult">
        <include refid="selectTgjjBsxxVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTgjjBsxx" parameterType="TgjjBsxx" useGeneratedKeys="true" keyProperty="ID">
        insert into tgjj_bsxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="JKHTBH != null">JKHTBH,</if>
            <if test="JKRXM != null">JKRXM,</if>
            <if test="JKRZJLX != null">JKRZJLX,</if>
            <if test="JKRZJH != null">JKRZJH,</if>
            <if test="SFST != null">SFST,</if>
            <if test="SFSB != null">SFSB,</if>
            <if test="DKLX != null">DKLX,</if>
            <if test="YDFKRQ != null">YDFKRQ,</if>
            <if test="YDDQRQ != null">YDDQRQ,</if>
            <if test="DKKHRQ != null">DKKHRQ,</if>
            <if test="SCHKRQ != null">SCHKRQ,</if>
            <if test="DKZT != null">DKZT,</if>
            <if test="DKJQRQ != null">DKJQRQ,</if>
            <if test="ZXBH != null">ZXBH,</if>
            <if test="lastUpdateTime != null">LAST_UPDATE_TIME,</if>
            <if test="CLLX != null">CLLX,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="JKHTBH != null">#{JKHTBH},</if>
            <if test="JKRXM != null">#{JKRXM},</if>
            <if test="JKRZJLX != null">#{JKRZJLX},</if>
            <if test="JKRZJH != null">#{JKRZJH},</if>
            <if test="SFST != null">#{SFST},</if>
            <if test="SFSB != null">#{SFSB},</if>
            <if test="DKLX != null">#{DKLX},</if>
            <if test="YDFKRQ != null">#{YDFKRQ},</if>
            <if test="YDDQRQ != null">#{YDDQRQ},</if>
            <if test="DKKHRQ != null">#{DKKHRQ},</if>
            <if test="SCHKRQ != null">#{SCHKRQ},</if>
            <if test="DKZT != null">#{DKZT},</if>
            <if test="DKJQRQ != null">#{DKJQRQ},</if>
            <if test="ZXBH != null">#{ZXBH},</if>
            <if test="lastUpdateTime != null">#{lastUpdateTime},</if>
            <if test="CLLX != null">#{CLLX},</if>
         </trim>
    </insert>

    <update id="updateTgjjBsxx" parameterType="TgjjBsxx">
        update tgjj_bsxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="JKHTBH != null">JKHTBH = #{JKHTBH},</if>
            <if test="JKRXM != null">JKRXM = #{JKRXM},</if>
            <if test="JKRZJLX != null">JKRZJLX = #{JKRZJLX},</if>
            <if test="JKRZJH != null">JKRZJH = #{JKRZJH},</if>
            <if test="SFST != null">SFST = #{SFST},</if>
            <if test="SFSB != null">SFSB = #{SFSB},</if>
            <if test="DKLX != null">DKLX = #{DKLX},</if>
            <if test="YDFKRQ != null">YDFKRQ = #{YDFKRQ},</if>
            <if test="YDDQRQ != null">YDDQRQ = #{YDDQRQ},</if>
            <if test="DKKHRQ != null">DKKHRQ = #{DKKHRQ},</if>
            <if test="SCHKRQ != null">SCHKRQ = #{SCHKRQ},</if>
            <if test="DKZT != null">DKZT = #{DKZT},</if>
            <if test="DKJQRQ != null">DKJQRQ = #{DKJQRQ},</if>
            <if test="ZXBH != null">ZXBH = #{ZXBH},</if>
            <if test="lastUpdateTime != null">LAST_UPDATE_TIME = #{lastUpdateTime},</if>
            <if test="CLLX != null">CLLX = #{CLLX},</if>
        </trim>
        where ID = #{ID}
    </update>

    <delete id="deleteTgjjBsxxById" parameterType="Long">
        delete from tgjj_bsxx where ID = #{ID}
    </delete>

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

</mapper>