<?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.TgjjGtjkrxxMapper">
    
    <resultMap type="TgjjGtjkrxx" id="TgjjGtjkrxxResult">
        <result property="ID"    column="ID"    />
        <result property="GTJKRGJJZH"    column="GTJKRGJJZH"    />
        <result property="JKHTBH"    column="JKHTBH"    />
        <result property="GTJKRXM"    column="GTJKRXM"    />
        <result property="GTJKRZJLX"    column="GTJKRZJLX"    />
        <result property="GTJKRZJHM"    column="GTJKRZJHM"    />
        <result property="YSR"    column="YSR"    />
        <result property="CDGX"    column="CDGX"    />
        <result property="SJHM"    column="SJHM"    />
        <result property="ZXBH"    column="ZXBH"    />
        <result property="lastUpdateTime"    column="LAST_UPDATE_TIME"    />
        <result property="CLLX"    column="CLLX"    />
    </resultMap>

    <sql id="selectTgjjGtjkrxxVo">
        select ID, GTJKRGJJZH, JKHTBH, GTJKRXM, GTJKRZJLX, GTJKRZJHM, YSR, CDGX, SJHM, ZXBH, LAST_UPDATE_TIME, CLLX from tgjj_gtjkrxx
    </sql>

    <select id="selectTgjjGtjkrxxList" parameterType="TgjjGtjkrxx" resultMap="TgjjGtjkrxxResult">
        <include refid="selectTgjjGtjkrxxVo"/>
        <where>  
            <if test="GTJKRGJJZH != null  and GTJKRGJJZH != ''"> and GTJKRGJJZH = #{GTJKRGJJZH}</if>
            <if test="JKHTBH != null  and JKHTBH != ''"> and JKHTBH = #{JKHTBH}</if>
            <if test="GTJKRXM != null  and GTJKRXM != ''"> and GTJKRXM = #{GTJKRXM}</if>
            <if test="GTJKRZJLX != null  and GTJKRZJLX != ''"> and GTJKRZJLX = #{GTJKRZJLX}</if>
            <if test="GTJKRZJHM != null  and GTJKRZJHM != ''"> and GTJKRZJHM = #{GTJKRZJHM}</if>
            <if test="YSR != null "> and YSR = #{YSR}</if>
            <if test="CDGX != null  and CDGX != ''"> and CDGX = #{CDGX}</if>
            <if test="SJHM != null  and SJHM != ''"> and SJHM = #{SJHM}</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="selectTgjjGtjkrxxById" parameterType="Long" resultMap="TgjjGtjkrxxResult">
        <include refid="selectTgjjGtjkrxxVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTgjjGtjkrxx" parameterType="TgjjGtjkrxx" useGeneratedKeys="true" keyProperty="ID">
        insert into tgjj_gtjkrxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="GTJKRGJJZH != null">GTJKRGJJZH,</if>
            <if test="JKHTBH != null">JKHTBH,</if>
            <if test="GTJKRXM != null">GTJKRXM,</if>
            <if test="GTJKRZJLX != null">GTJKRZJLX,</if>
            <if test="GTJKRZJHM != null">GTJKRZJHM,</if>
            <if test="YSR != null">YSR,</if>
            <if test="CDGX != null">CDGX,</if>
            <if test="SJHM != null">SJHM,</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="GTJKRGJJZH != null">#{GTJKRGJJZH},</if>
            <if test="JKHTBH != null">#{JKHTBH},</if>
            <if test="GTJKRXM != null">#{GTJKRXM},</if>
            <if test="GTJKRZJLX != null">#{GTJKRZJLX},</if>
            <if test="GTJKRZJHM != null">#{GTJKRZJHM},</if>
            <if test="YSR != null">#{YSR},</if>
            <if test="CDGX != null">#{CDGX},</if>
            <if test="SJHM != null">#{SJHM},</if>
            <if test="ZXBH != null">#{ZXBH},</if>
            <if test="lastUpdateTime != null">#{lastUpdateTime},</if>
            <if test="CLLX != null">#{CLLX},</if>
         </trim>
    </insert>

    <update id="updateTgjjGtjkrxx" parameterType="TgjjGtjkrxx">
        update tgjj_gtjkrxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="GTJKRGJJZH != null">GTJKRGJJZH = #{GTJKRGJJZH},</if>
            <if test="JKHTBH != null">JKHTBH = #{JKHTBH},</if>
            <if test="GTJKRXM != null">GTJKRXM = #{GTJKRXM},</if>
            <if test="GTJKRZJLX != null">GTJKRZJLX = #{GTJKRZJLX},</if>
            <if test="GTJKRZJHM != null">GTJKRZJHM = #{GTJKRZJHM},</if>
            <if test="YSR != null">YSR = #{YSR},</if>
            <if test="CDGX != null">CDGX = #{CDGX},</if>
            <if test="SJHM != null">SJHM = #{SJHM},</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="deleteTgjjGtjkrxxById" parameterType="Long">
        delete from tgjj_gtjkrxx where ID = #{ID}
    </delete>

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

</mapper>