<?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.TgjjGrzhxxMapper">
    
    <resultMap type="TgjjGrzhxx" id="TgjjGrzhxxResult">
        <result property="ID"    column="ID"    />
        <result property="DWZH"    column="DWZH"    />
        <result property="GRJCBL"    column="GRJCBL"    />
        <result property="JZNY"    column="JZNY"    />
        <result property="GRZH"    column="GRZH"    />
        <result property="GRJCJS"    column="GRJCJS"    />
        <result property="GRZHZT"    column="GRZHZT"    />
        <result property="KHRQ"    column="KHRQ"    />
        <result property="GRZHYE"    column="GRZHYE"    />
        <result property="GRZHSNJZYE"    column="GRZHSNJZYE"    />
        <result property="GRZHDNGJYE"    column="GRZHDNGJYE"    />
        <result property="GRYJCE"    column="GRYJCE"    />
        <result property="DWYJCE"    column="DWYJCE"    />
        <result property="XHRQ"    column="XHRQ"    />
        <result property="XHYY"    column="XHYY"    />
        <result property="GRCKZHHM"    column="GRCKZHHM"    />
        <result property="GRCKZHKHYHMC"    column="GRCKZHKHYHMC"    />
        <result property="GRCKZHKHYHDM"    column="GRCKZHKHYHDM"    />
        <result property="ZXBH"    column="ZXBH"    />
        <result property="lastUpdateTime"    column="LAST_UPDATE_TIME"    />
        <result property="CLLX"    column="CLLX"    />
    </resultMap>

    <sql id="selectTgjjGrzhxxVo">
        select ID, DWZH, GRJCBL, JZNY, GRZH, GRJCJS, GRZHZT, KHRQ, GRZHYE, GRZHSNJZYE, GRZHDNGJYE, GRYJCE, DWYJCE, XHRQ, XHYY, GRCKZHHM, GRCKZHKHYHMC, GRCKZHKHYHDM, ZXBH, LAST_UPDATE_TIME, CLLX from tgjj_grzhxx
    </sql>

    <select id="selectTgjjGrzhxxList" parameterType="TgjjGrzhxx" resultMap="TgjjGrzhxxResult">
        <include refid="selectTgjjGrzhxxVo"/>
        <where>  
            <if test="DWZH != null  and DWZH != ''"> and DWZH = #{DWZH}</if>
            <if test="GRJCBL != null "> and GRJCBL = #{GRJCBL}</if>
            <if test="JZNY != null  and JZNY != ''"> and JZNY = #{JZNY}</if>
            <if test="GRZH != null  and GRZH != ''"> and GRZH = #{GRZH}</if>
            <if test="GRJCJS != null "> and GRJCJS = #{GRJCJS}</if>
            <if test="GRZHZT != null  and GRZHZT != ''"> and GRZHZT = #{GRZHZT}</if>
            <if test="KHRQ != null "> and KHRQ = #{KHRQ}</if>
            <if test="GRZHYE != null "> and GRZHYE = #{GRZHYE}</if>
            <if test="GRZHSNJZYE != null "> and GRZHSNJZYE = #{GRZHSNJZYE}</if>
            <if test="GRZHDNGJYE != null "> and GRZHDNGJYE = #{GRZHDNGJYE}</if>
            <if test="GRYJCE != null "> and GRYJCE = #{GRYJCE}</if>
            <if test="DWYJCE != null "> and DWYJCE = #{DWYJCE}</if>
            <if test="XHRQ != null "> and XHRQ = #{XHRQ}</if>
            <if test="XHYY != null  and XHYY != ''"> and XHYY = #{XHYY}</if>
            <if test="GRCKZHHM != null  and GRCKZHHM != ''"> and GRCKZHHM = #{GRCKZHHM}</if>
            <if test="GRCKZHKHYHMC != null  and GRCKZHKHYHMC != ''"> and GRCKZHKHYHMC = #{GRCKZHKHYHMC}</if>
            <if test="GRCKZHKHYHDM != null  and GRCKZHKHYHDM != ''"> and GRCKZHKHYHDM = #{GRCKZHKHYHDM}</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="selectTgjjGrzhxxById" parameterType="Long" resultMap="TgjjGrzhxxResult">
        <include refid="selectTgjjGrzhxxVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTgjjGrzhxx" parameterType="TgjjGrzhxx" useGeneratedKeys="true" keyProperty="ID">
        insert into tgjj_grzhxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="DWZH != null">DWZH,</if>
            <if test="GRJCBL != null">GRJCBL,</if>
            <if test="JZNY != null">JZNY,</if>
            <if test="GRZH != null">GRZH,</if>
            <if test="GRJCJS != null">GRJCJS,</if>
            <if test="GRZHZT != null">GRZHZT,</if>
            <if test="KHRQ != null">KHRQ,</if>
            <if test="GRZHYE != null">GRZHYE,</if>
            <if test="GRZHSNJZYE != null">GRZHSNJZYE,</if>
            <if test="GRZHDNGJYE != null">GRZHDNGJYE,</if>
            <if test="GRYJCE != null">GRYJCE,</if>
            <if test="DWYJCE != null">DWYJCE,</if>
            <if test="XHRQ != null">XHRQ,</if>
            <if test="XHYY != null">XHYY,</if>
            <if test="GRCKZHHM != null">GRCKZHHM,</if>
            <if test="GRCKZHKHYHMC != null">GRCKZHKHYHMC,</if>
            <if test="GRCKZHKHYHDM != null">GRCKZHKHYHDM,</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="DWZH != null">#{DWZH},</if>
            <if test="GRJCBL != null">#{GRJCBL},</if>
            <if test="JZNY != null">#{JZNY},</if>
            <if test="GRZH != null">#{GRZH},</if>
            <if test="GRJCJS != null">#{GRJCJS},</if>
            <if test="GRZHZT != null">#{GRZHZT},</if>
            <if test="KHRQ != null">#{KHRQ},</if>
            <if test="GRZHYE != null">#{GRZHYE},</if>
            <if test="GRZHSNJZYE != null">#{GRZHSNJZYE},</if>
            <if test="GRZHDNGJYE != null">#{GRZHDNGJYE},</if>
            <if test="GRYJCE != null">#{GRYJCE},</if>
            <if test="DWYJCE != null">#{DWYJCE},</if>
            <if test="XHRQ != null">#{XHRQ},</if>
            <if test="XHYY != null">#{XHYY},</if>
            <if test="GRCKZHHM != null">#{GRCKZHHM},</if>
            <if test="GRCKZHKHYHMC != null">#{GRCKZHKHYHMC},</if>
            <if test="GRCKZHKHYHDM != null">#{GRCKZHKHYHDM},</if>
            <if test="ZXBH != null">#{ZXBH},</if>
            <if test="lastUpdateTime != null">#{lastUpdateTime},</if>
            <if test="CLLX != null">#{CLLX},</if>
         </trim>
    </insert>

    <update id="updateTgjjGrzhxx" parameterType="TgjjGrzhxx">
        update tgjj_grzhxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="DWZH != null">DWZH = #{DWZH},</if>
            <if test="GRJCBL != null">GRJCBL = #{GRJCBL},</if>
            <if test="JZNY != null">JZNY = #{JZNY},</if>
            <if test="GRZH != null">GRZH = #{GRZH},</if>
            <if test="GRJCJS != null">GRJCJS = #{GRJCJS},</if>
            <if test="GRZHZT != null">GRZHZT = #{GRZHZT},</if>
            <if test="KHRQ != null">KHRQ = #{KHRQ},</if>
            <if test="GRZHYE != null">GRZHYE = #{GRZHYE},</if>
            <if test="GRZHSNJZYE != null">GRZHSNJZYE = #{GRZHSNJZYE},</if>
            <if test="GRZHDNGJYE != null">GRZHDNGJYE = #{GRZHDNGJYE},</if>
            <if test="GRYJCE != null">GRYJCE = #{GRYJCE},</if>
            <if test="DWYJCE != null">DWYJCE = #{DWYJCE},</if>
            <if test="XHRQ != null">XHRQ = #{XHRQ},</if>
            <if test="XHYY != null">XHYY = #{XHYY},</if>
            <if test="GRCKZHHM != null">GRCKZHHM = #{GRCKZHHM},</if>
            <if test="GRCKZHKHYHMC != null">GRCKZHKHYHMC = #{GRCKZHKHYHMC},</if>
            <if test="GRCKZHKHYHDM != null">GRCKZHKHYHDM = #{GRCKZHKHYHDM},</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="deleteTgjjGrzhxxById" parameterType="Long">
        delete from tgjj_grzhxx where ID = #{ID}
    </delete>

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

</mapper>