<?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.TgjjGrdkyqxxMapper">
    
    <resultMap type="TgjjGrdkyqxx" id="TgjjGrdkyqxxResult">
        <result property="ID"    column="ID"    />
        <result property="IDXH"    column="IDXH"    />
        <result property="DKZH"    column="DKZH"    />
        <result property="YQQC"    column="YQQC"    />
        <result property="YQBJ"    column="YQBJ"    />
        <result property="YQLX"    column="YQLX"    />
        <result property="YQFX"    column="YQFX"    />
        <result property="SSRQ"    column="SSRQ"    />
        <result property="HKQC"    column="HKQC"    />
        <result property="SSYQBJJE"    column="SSYQBJJE"    />
        <result property="SSYQLXJE"    column="SSYQLXJE"    />
        <result property="SSYQFXJE"    column="SSYQFXJE"    />
        <result property="ZXBH"    column="ZXBH"    />
        <result property="lastUpdateTime"    column="LAST_UPDATE_TIME"    />
        <result property="CLLX"    column="CLLX"    />
    </resultMap>

    <sql id="selectTgjjGrdkyqxxVo">
        select ID, IDXH, DKZH, YQQC, YQBJ, YQLX, YQFX, SSRQ, HKQC, SSYQBJJE, SSYQLXJE, SSYQFXJE, ZXBH, LAST_UPDATE_TIME, CLLX from tgjj_grdkyqxx
    </sql>

    <select id="selectTgjjGrdkyqxxList" parameterType="TgjjGrdkyqxx" resultMap="TgjjGrdkyqxxResult">
        <include refid="selectTgjjGrdkyqxxVo"/>
        <where>  
            <if test="IDXH != null  and IDXH != ''"> and IDXH = #{IDXH}</if>
            <if test="DKZH != null  and DKZH != ''"> and DKZH = #{DKZH}</if>
            <if test="YQQC != null "> and YQQC = #{YQQC}</if>
            <if test="YQBJ != null "> and YQBJ = #{YQBJ}</if>
            <if test="YQLX != null "> and YQLX = #{YQLX}</if>
            <if test="YQFX != null "> and YQFX = #{YQFX}</if>
            <if test="SSRQ != null "> and SSRQ = #{SSRQ}</if>
            <if test="HKQC != null "> and HKQC = #{HKQC}</if>
            <if test="SSYQBJJE != null "> and SSYQBJJE = #{SSYQBJJE}</if>
            <if test="SSYQLXJE != null "> and SSYQLXJE = #{SSYQLXJE}</if>
            <if test="SSYQFXJE != null "> and SSYQFXJE = #{SSYQFXJE}</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="selectTgjjGrdkyqxxById" parameterType="Long" resultMap="TgjjGrdkyqxxResult">
        <include refid="selectTgjjGrdkyqxxVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTgjjGrdkyqxx" parameterType="TgjjGrdkyqxx" useGeneratedKeys="true" keyProperty="ID">
        insert into tgjj_grdkyqxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="IDXH != null">IDXH,</if>
            <if test="DKZH != null">DKZH,</if>
            <if test="YQQC != null">YQQC,</if>
            <if test="YQBJ != null">YQBJ,</if>
            <if test="YQLX != null">YQLX,</if>
            <if test="YQFX != null">YQFX,</if>
            <if test="SSRQ != null">SSRQ,</if>
            <if test="HKQC != null">HKQC,</if>
            <if test="SSYQBJJE != null">SSYQBJJE,</if>
            <if test="SSYQLXJE != null">SSYQLXJE,</if>
            <if test="SSYQFXJE != null">SSYQFXJE,</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="IDXH != null">#{IDXH},</if>
            <if test="DKZH != null">#{DKZH},</if>
            <if test="YQQC != null">#{YQQC},</if>
            <if test="YQBJ != null">#{YQBJ},</if>
            <if test="YQLX != null">#{YQLX},</if>
            <if test="YQFX != null">#{YQFX},</if>
            <if test="SSRQ != null">#{SSRQ},</if>
            <if test="HKQC != null">#{HKQC},</if>
            <if test="SSYQBJJE != null">#{SSYQBJJE},</if>
            <if test="SSYQLXJE != null">#{SSYQLXJE},</if>
            <if test="SSYQFXJE != null">#{SSYQFXJE},</if>
            <if test="ZXBH != null">#{ZXBH},</if>
            <if test="lastUpdateTime != null">#{lastUpdateTime},</if>
            <if test="CLLX != null">#{CLLX},</if>
         </trim>
    </insert>

    <update id="updateTgjjGrdkyqxx" parameterType="TgjjGrdkyqxx">
        update tgjj_grdkyqxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="IDXH != null">IDXH = #{IDXH},</if>
            <if test="DKZH != null">DKZH = #{DKZH},</if>
            <if test="YQQC != null">YQQC = #{YQQC},</if>
            <if test="YQBJ != null">YQBJ = #{YQBJ},</if>
            <if test="YQLX != null">YQLX = #{YQLX},</if>
            <if test="YQFX != null">YQFX = #{YQFX},</if>
            <if test="SSRQ != null">SSRQ = #{SSRQ},</if>
            <if test="HKQC != null">HKQC = #{HKQC},</if>
            <if test="SSYQBJJE != null">SSYQBJJE = #{SSYQBJJE},</if>
            <if test="SSYQLXJE != null">SSYQLXJE = #{SSYQLXJE},</if>
            <if test="SSYQFXJE != null">SSYQFXJE = #{SSYQFXJE},</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="deleteTgjjGrdkyqxxById" parameterType="Long">
        delete from tgjj_grdkyqxx where ID = #{ID}
    </delete>

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

</mapper>