<?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.TgjjGrdkzhbdxxMapper">
    
    <resultMap type="TgjjGrdkzhbdxx" id="TgjjGrdkzhbdxxResult">
        <result property="ID"    column="ID"    />
        <result property="DKZH"    column="DKZH"    />
        <result property="YWLSH"    column="YWLSH"    />
        <result property="DKYWMXLX"    column="DKYWMXLX"    />
        <result property="YWFSRQ"    column="YWFSRQ"    />
        <result property="DKYHDM"    column="DKYHDM"    />
        <result property="FSE"    column="FSE"    />
        <result property="BJJE"    column="BJJE"    />
        <result property="LXJE"    column="LXJE"    />
        <result property="FXJE"    column="FXJE"    />
        <result property="DQQC"    column="DQQC"    />
        <result property="ZCZYQBJJE"    column="ZCZYQBJJE"    />
        <result property="YQZZCBJJE"    column="YQZZCBJJE"    />
        <result property="JZRQ"    column="JZRQ"    />
        <result property="ZXBH"    column="ZXBH"    />
        <result property="lastUpdateTime"    column="LAST_UPDATE_TIME"    />
        <result property="CLLX"    column="CLLX"    />
    </resultMap>

    <sql id="selectTgjjGrdkzhbdxxVo">
        select ID, DKZH, YWLSH, DKYWMXLX, YWFSRQ, DKYHDM, FSE, BJJE, LXJE, FXJE, DQQC, ZCZYQBJJE, YQZZCBJJE, JZRQ, ZXBH, LAST_UPDATE_TIME, CLLX from tgjj_grdkzhbdxx
    </sql>

    <select id="selectTgjjGrdkzhbdxxList" parameterType="TgjjGrdkzhbdxx" resultMap="TgjjGrdkzhbdxxResult">
        <include refid="selectTgjjGrdkzhbdxxVo"/>
        <where>  
            <if test="DKZH != null  and DKZH != ''"> and DKZH = #{DKZH}</if>
            <if test="YWLSH != null  and YWLSH != ''"> and YWLSH = #{YWLSH}</if>
            <if test="DKYWMXLX != null  and DKYWMXLX != ''"> and DKYWMXLX = #{DKYWMXLX}</if>
            <if test="YWFSRQ != null "> and YWFSRQ = #{YWFSRQ}</if>
            <if test="DKYHDM != null  and DKYHDM != ''"> and DKYHDM = #{DKYHDM}</if>
            <if test="FSE != null "> and FSE = #{FSE}</if>
            <if test="BJJE != null "> and BJJE = #{BJJE}</if>
            <if test="LXJE != null "> and LXJE = #{LXJE}</if>
            <if test="FXJE != null "> and FXJE = #{FXJE}</if>
            <if test="DQQC != null "> and DQQC = #{DQQC}</if>
            <if test="ZCZYQBJJE != null "> and ZCZYQBJJE = #{ZCZYQBJJE}</if>
            <if test="YQZZCBJJE != null "> and YQZZCBJJE = #{YQZZCBJJE}</if>
            <if test="JZRQ != null "> and JZRQ = #{JZRQ}</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="selectTgjjGrdkzhbdxxById" parameterType="Long" resultMap="TgjjGrdkzhbdxxResult">
        <include refid="selectTgjjGrdkzhbdxxVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTgjjGrdkzhbdxx" parameterType="TgjjGrdkzhbdxx" useGeneratedKeys="true" keyProperty="ID">
        insert into tgjj_grdkzhbdxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="DKZH != null">DKZH,</if>
            <if test="YWLSH != null">YWLSH,</if>
            <if test="DKYWMXLX != null">DKYWMXLX,</if>
            <if test="YWFSRQ != null">YWFSRQ,</if>
            <if test="DKYHDM != null">DKYHDM,</if>
            <if test="FSE != null">FSE,</if>
            <if test="BJJE != null">BJJE,</if>
            <if test="LXJE != null">LXJE,</if>
            <if test="FXJE != null">FXJE,</if>
            <if test="DQQC != null">DQQC,</if>
            <if test="ZCZYQBJJE != null">ZCZYQBJJE,</if>
            <if test="YQZZCBJJE != null">YQZZCBJJE,</if>
            <if test="JZRQ != null">JZRQ,</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="DKZH != null">#{DKZH},</if>
            <if test="YWLSH != null">#{YWLSH},</if>
            <if test="DKYWMXLX != null">#{DKYWMXLX},</if>
            <if test="YWFSRQ != null">#{YWFSRQ},</if>
            <if test="DKYHDM != null">#{DKYHDM},</if>
            <if test="FSE != null">#{FSE},</if>
            <if test="BJJE != null">#{BJJE},</if>
            <if test="LXJE != null">#{LXJE},</if>
            <if test="FXJE != null">#{FXJE},</if>
            <if test="DQQC != null">#{DQQC},</if>
            <if test="ZCZYQBJJE != null">#{ZCZYQBJJE},</if>
            <if test="YQZZCBJJE != null">#{YQZZCBJJE},</if>
            <if test="JZRQ != null">#{JZRQ},</if>
            <if test="ZXBH != null">#{ZXBH},</if>
            <if test="lastUpdateTime != null">#{lastUpdateTime},</if>
            <if test="CLLX != null">#{CLLX},</if>
         </trim>
    </insert>

    <update id="updateTgjjGrdkzhbdxx" parameterType="TgjjGrdkzhbdxx">
        update tgjj_grdkzhbdxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="DKZH != null">DKZH = #{DKZH},</if>
            <if test="YWLSH != null">YWLSH = #{YWLSH},</if>
            <if test="DKYWMXLX != null">DKYWMXLX = #{DKYWMXLX},</if>
            <if test="YWFSRQ != null">YWFSRQ = #{YWFSRQ},</if>
            <if test="DKYHDM != null">DKYHDM = #{DKYHDM},</if>
            <if test="FSE != null">FSE = #{FSE},</if>
            <if test="BJJE != null">BJJE = #{BJJE},</if>
            <if test="LXJE != null">LXJE = #{LXJE},</if>
            <if test="FXJE != null">FXJE = #{FXJE},</if>
            <if test="DQQC != null">DQQC = #{DQQC},</if>
            <if test="ZCZYQBJJE != null">ZCZYQBJJE = #{ZCZYQBJJE},</if>
            <if test="YQZZCBJJE != null">YQZZCBJJE = #{YQZZCBJJE},</if>
            <if test="JZRQ != null">JZRQ = #{JZRQ},</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="deleteTgjjGrdkzhbdxxById" parameterType="Long">
        delete from tgjj_grdkzhbdxx where ID = #{ID}
    </delete>

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

</mapper>