<?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.TgjjZcxxMapper">
    
    <resultMap type="TgjjZcxx" id="TgjjZcxxResult">
        <result property="ID"    column="ID"    />
        <result property="DWJCBLSX"    column="DWJCBLSX"    />
        <result property="DWJCBLXX"    column="DWJCBLXX"    />
        <result property="GRJCBLSX"    column="GRJCBLSX"    />
        <result property="GRJCBLXX"    column="GRJCBLXX"    />
        <result property="YJCESX"    column="YJCESX"    />
        <result property="YJCEXX"    column="YJCEXX"    />
        <result property="GRZFDKZCNX"    column="GRZFDKZCNX"    />
        <result property="GRZFDKZGED"    column="GRZFDKZGED"    />
        <result property="GRZFDKZGDKBL"    column="GRZFDKZGDKBL"    />
        <result property="XMDKZCNX"    column="XMDKZCNX"    />
        <result property="XMDKZGDKBL"    column="XMDKZGDKBL"    />
        <result property="DJCZGZGDKED"    column="DJCZGZGDKED"    />
        <result property="ZXBH"    column="ZXBH"    />
        <result property="JCJSSX"    column="JCJSSX"    />
        <result property="JCJSXX"    column="JCJSXX"    />
        <result property="GRZFDKYGSR"    column="GRZFDKYGSR"    />
        <result property="DKJCYS"    column="DKJCYS"    />
        <result property="ZFTQJCYS"    column="ZFTQJCYS"    />
        <result property="lastUpdateTime"    column="LAST_UPDATE_TIME"    />
        <result property="CLLX"    column="CLLX"    />
    </resultMap>

    <sql id="selectTgjjZcxxVo">
        select ID, DWJCBLSX, DWJCBLXX, GRJCBLSX, GRJCBLXX, YJCESX, YJCEXX, GRZFDKZCNX, GRZFDKZGED, GRZFDKZGDKBL, XMDKZCNX, XMDKZGDKBL, DJCZGZGDKED, ZXBH, JCJSSX, JCJSXX, GRZFDKYGSR, DKJCYS, ZFTQJCYS, LAST_UPDATE_TIME, CLLX from tgjj_zcxx
    </sql>

    <select id="selectTgjjZcxxList" parameterType="TgjjZcxx" resultMap="TgjjZcxxResult">
        <include refid="selectTgjjZcxxVo"/>
        <where>  
            <if test="DWJCBLSX != null "> and DWJCBLSX = #{DWJCBLSX}</if>
            <if test="DWJCBLXX != null "> and DWJCBLXX = #{DWJCBLXX}</if>
            <if test="GRJCBLSX != null "> and GRJCBLSX = #{GRJCBLSX}</if>
            <if test="GRJCBLXX != null "> and GRJCBLXX = #{GRJCBLXX}</if>
            <if test="YJCESX != null "> and YJCESX = #{YJCESX}</if>
            <if test="YJCEXX != null "> and YJCEXX = #{YJCEXX}</if>
            <if test="GRZFDKZCNX != null "> and GRZFDKZCNX = #{GRZFDKZCNX}</if>
            <if test="GRZFDKZGED != null "> and GRZFDKZGED = #{GRZFDKZGED}</if>
            <if test="GRZFDKZGDKBL != null "> and GRZFDKZGDKBL = #{GRZFDKZGDKBL}</if>
            <if test="XMDKZCNX != null "> and XMDKZCNX = #{XMDKZCNX}</if>
            <if test="XMDKZGDKBL != null "> and XMDKZGDKBL = #{XMDKZGDKBL}</if>
            <if test="DJCZGZGDKED != null "> and DJCZGZGDKED = #{DJCZGZGDKED}</if>
            <if test="ZXBH != null  and ZXBH != ''"> and ZXBH = #{ZXBH}</if>
            <if test="JCJSSX != null "> and JCJSSX = #{JCJSSX}</if>
            <if test="JCJSXX != null "> and JCJSXX = #{JCJSXX}</if>
            <if test="GRZFDKYGSR != null "> and GRZFDKYGSR = #{GRZFDKYGSR}</if>
            <if test="DKJCYS != null "> and DKJCYS = #{DKJCYS}</if>
            <if test="ZFTQJCYS != null "> and ZFTQJCYS = #{ZFTQJCYS}</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="selectTgjjZcxxById" parameterType="Long" resultMap="TgjjZcxxResult">
        <include refid="selectTgjjZcxxVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTgjjZcxx" parameterType="TgjjZcxx" useGeneratedKeys="true" keyProperty="ID">
        insert into tgjj_zcxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="DWJCBLSX != null">DWJCBLSX,</if>
            <if test="DWJCBLXX != null">DWJCBLXX,</if>
            <if test="GRJCBLSX != null">GRJCBLSX,</if>
            <if test="GRJCBLXX != null">GRJCBLXX,</if>
            <if test="YJCESX != null">YJCESX,</if>
            <if test="YJCEXX != null">YJCEXX,</if>
            <if test="GRZFDKZCNX != null">GRZFDKZCNX,</if>
            <if test="GRZFDKZGED != null">GRZFDKZGED,</if>
            <if test="GRZFDKZGDKBL != null">GRZFDKZGDKBL,</if>
            <if test="XMDKZCNX != null">XMDKZCNX,</if>
            <if test="XMDKZGDKBL != null">XMDKZGDKBL,</if>
            <if test="DJCZGZGDKED != null">DJCZGZGDKED,</if>
            <if test="ZXBH != null">ZXBH,</if>
            <if test="JCJSSX != null">JCJSSX,</if>
            <if test="JCJSXX != null">JCJSXX,</if>
            <if test="GRZFDKYGSR != null">GRZFDKYGSR,</if>
            <if test="DKJCYS != null">DKJCYS,</if>
            <if test="ZFTQJCYS != null">ZFTQJCYS,</if>
            <if test="lastUpdateTime != null">LAST_UPDATE_TIME,</if>
            <if test="CLLX != null">CLLX,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="DWJCBLSX != null">#{DWJCBLSX},</if>
            <if test="DWJCBLXX != null">#{DWJCBLXX},</if>
            <if test="GRJCBLSX != null">#{GRJCBLSX},</if>
            <if test="GRJCBLXX != null">#{GRJCBLXX},</if>
            <if test="YJCESX != null">#{YJCESX},</if>
            <if test="YJCEXX != null">#{YJCEXX},</if>
            <if test="GRZFDKZCNX != null">#{GRZFDKZCNX},</if>
            <if test="GRZFDKZGED != null">#{GRZFDKZGED},</if>
            <if test="GRZFDKZGDKBL != null">#{GRZFDKZGDKBL},</if>
            <if test="XMDKZCNX != null">#{XMDKZCNX},</if>
            <if test="XMDKZGDKBL != null">#{XMDKZGDKBL},</if>
            <if test="DJCZGZGDKED != null">#{DJCZGZGDKED},</if>
            <if test="ZXBH != null">#{ZXBH},</if>
            <if test="JCJSSX != null">#{JCJSSX},</if>
            <if test="JCJSXX != null">#{JCJSXX},</if>
            <if test="GRZFDKYGSR != null">#{GRZFDKYGSR},</if>
            <if test="DKJCYS != null">#{DKJCYS},</if>
            <if test="ZFTQJCYS != null">#{ZFTQJCYS},</if>
            <if test="lastUpdateTime != null">#{lastUpdateTime},</if>
            <if test="CLLX != null">#{CLLX},</if>
         </trim>
    </insert>

    <update id="updateTgjjZcxx" parameterType="TgjjZcxx">
        update tgjj_zcxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="DWJCBLSX != null">DWJCBLSX = #{DWJCBLSX},</if>
            <if test="DWJCBLXX != null">DWJCBLXX = #{DWJCBLXX},</if>
            <if test="GRJCBLSX != null">GRJCBLSX = #{GRJCBLSX},</if>
            <if test="GRJCBLXX != null">GRJCBLXX = #{GRJCBLXX},</if>
            <if test="YJCESX != null">YJCESX = #{YJCESX},</if>
            <if test="YJCEXX != null">YJCEXX = #{YJCEXX},</if>
            <if test="GRZFDKZCNX != null">GRZFDKZCNX = #{GRZFDKZCNX},</if>
            <if test="GRZFDKZGED != null">GRZFDKZGED = #{GRZFDKZGED},</if>
            <if test="GRZFDKZGDKBL != null">GRZFDKZGDKBL = #{GRZFDKZGDKBL},</if>
            <if test="XMDKZCNX != null">XMDKZCNX = #{XMDKZCNX},</if>
            <if test="XMDKZGDKBL != null">XMDKZGDKBL = #{XMDKZGDKBL},</if>
            <if test="DJCZGZGDKED != null">DJCZGZGDKED = #{DJCZGZGDKED},</if>
            <if test="ZXBH != null">ZXBH = #{ZXBH},</if>
            <if test="JCJSSX != null">JCJSSX = #{JCJSSX},</if>
            <if test="JCJSXX != null">JCJSXX = #{JCJSXX},</if>
            <if test="GRZFDKYGSR != null">GRZFDKYGSR = #{GRZFDKYGSR},</if>
            <if test="DKJCYS != null">DKJCYS = #{DKJCYS},</if>
            <if test="ZFTQJCYS != null">ZFTQJCYS = #{ZFTQJCYS},</if>
            <if test="lastUpdateTime != null">LAST_UPDATE_TIME = #{lastUpdateTime},</if>
            <if test="CLLX != null">CLLX = #{CLLX},</if>
        </trim>
        where ID = #{ID}
    </update>

    <delete id="deleteTgjjZcxxById" parameterType="Long">
        delete from tgjj_zcxx where ID = #{ID}
    </delete>

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

</mapper>