<?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.TgjjGrxxMapper">
    
    <resultMap type="TgjjGrxx" id="TgjjGrxxResult">
        <result property="ID"    column="ID"    />
        <result property="GRZH"    column="GRZH"    />
        <result property="XINGMING"    column="XINGMING"    />
        <result property="XMQP"    column="XMQP"    />
        <result property="XINGBIE"    column="XINGBIE"    />
        <result property="GDDHHM"    column="GDDHHM"    />
        <result property="SJHM"    column="SJHM"    />
        <result property="ZJLX"    column="ZJLX"    />
        <result property="ZJHM"    column="ZJHM"    />
        <result property="CSNY"    column="CSNY"    />
        <result property="HYZK"    column="HYZK"    />
        <result property="ZHIYE"    column="ZHIYE"    />
        <result property="ZHICHEN"    column="ZHICHEN"    />
        <result property="ZHIWU"    column="ZHIWU"    />
        <result property="XUELI"    column="XUELI"    />
        <result property="YZBM"    column="YZBM"    />
        <result property="JTZZ"    column="JTZZ"    />
        <result property="JTYSR"    column="JTYSR"    />
        <result property="ZXBH"    column="ZXBH"    />
        <result property="lastUpdateTime"    column="LAST_UPDATE_TIME"    />
        <result property="CLLX"    column="CLLX"    />
    </resultMap>

    <sql id="selectTgjjGrxxVo">
        select ID, GRZH, XINGMING, XMQP, XINGBIE, GDDHHM, SJHM, ZJLX, ZJHM, CSNY, HYZK, ZHIYE, ZHICHEN, ZHIWU, XUELI, YZBM, JTZZ, JTYSR, ZXBH, LAST_UPDATE_TIME, CLLX from tgjj_grxx
    </sql>

    <select id="selectTgjjGrxxList" parameterType="TgjjGrxx" resultMap="TgjjGrxxResult">
        <include refid="selectTgjjGrxxVo"/>
        <where>  
            <if test="GRZH != null  and GRZH != ''"> and GRZH = #{GRZH}</if>
            <if test="XINGMING != null  and XINGMING != ''"> and XINGMING = #{XINGMING}</if>
            <if test="XMQP != null  and XMQP != ''"> and XMQP = #{XMQP}</if>
            <if test="XINGBIE != null  and XINGBIE != ''"> and XINGBIE = #{XINGBIE}</if>
            <if test="GDDHHM != null  and GDDHHM != ''"> and GDDHHM = #{GDDHHM}</if>
            <if test="SJHM != null  and SJHM != ''"> and SJHM = #{SJHM}</if>
            <if test="ZJLX != null  and ZJLX != ''"> and ZJLX = #{ZJLX}</if>
            <if test="ZJHM != null  and ZJHM != ''"> and ZJHM = #{ZJHM}</if>
            <if test="CSNY != null  and CSNY != ''"> and CSNY = #{CSNY}</if>
            <if test="HYZK != null  and HYZK != ''"> and HYZK = #{HYZK}</if>
            <if test="ZHIYE != null  and ZHIYE != ''"> and ZHIYE = #{ZHIYE}</if>
            <if test="ZHICHEN != null  and ZHICHEN != ''"> and ZHICHEN = #{ZHICHEN}</if>
            <if test="ZHIWU != null  and ZHIWU != ''"> and ZHIWU = #{ZHIWU}</if>
            <if test="XUELI != null  and XUELI != ''"> and XUELI = #{XUELI}</if>
            <if test="YZBM != null  and YZBM != ''"> and YZBM = #{YZBM}</if>
            <if test="JTZZ != null  and JTZZ != ''"> and JTZZ = #{JTZZ}</if>
            <if test="JTYSR != null "> and JTYSR = #{JTYSR}</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="selectTgjjGrxxById" parameterType="Long" resultMap="TgjjGrxxResult">
        <include refid="selectTgjjGrxxVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTgjjGrxx" parameterType="TgjjGrxx" useGeneratedKeys="true" keyProperty="ID">
        insert into tgjj_grxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="GRZH != null and GRZH != ''">GRZH,</if>
            <if test="XINGMING != null">XINGMING,</if>
            <if test="XMQP != null">XMQP,</if>
            <if test="XINGBIE != null">XINGBIE,</if>
            <if test="GDDHHM != null">GDDHHM,</if>
            <if test="SJHM != null">SJHM,</if>
            <if test="ZJLX != null">ZJLX,</if>
            <if test="ZJHM != null">ZJHM,</if>
            <if test="CSNY != null">CSNY,</if>
            <if test="HYZK != null">HYZK,</if>
            <if test="ZHIYE != null">ZHIYE,</if>
            <if test="ZHICHEN != null">ZHICHEN,</if>
            <if test="ZHIWU != null">ZHIWU,</if>
            <if test="XUELI != null">XUELI,</if>
            <if test="YZBM != null">YZBM,</if>
            <if test="JTZZ != null">JTZZ,</if>
            <if test="JTYSR != null">JTYSR,</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="GRZH != null and GRZH != ''">#{GRZH},</if>
            <if test="XINGMING != null">#{XINGMING},</if>
            <if test="XMQP != null">#{XMQP},</if>
            <if test="XINGBIE != null">#{XINGBIE},</if>
            <if test="GDDHHM != null">#{GDDHHM},</if>
            <if test="SJHM != null">#{SJHM},</if>
            <if test="ZJLX != null">#{ZJLX},</if>
            <if test="ZJHM != null">#{ZJHM},</if>
            <if test="CSNY != null">#{CSNY},</if>
            <if test="HYZK != null">#{HYZK},</if>
            <if test="ZHIYE != null">#{ZHIYE},</if>
            <if test="ZHICHEN != null">#{ZHICHEN},</if>
            <if test="ZHIWU != null">#{ZHIWU},</if>
            <if test="XUELI != null">#{XUELI},</if>
            <if test="YZBM != null">#{YZBM},</if>
            <if test="JTZZ != null">#{JTZZ},</if>
            <if test="JTYSR != null">#{JTYSR},</if>
            <if test="ZXBH != null">#{ZXBH},</if>
            <if test="lastUpdateTime != null">#{lastUpdateTime},</if>
            <if test="CLLX != null">#{CLLX},</if>
         </trim>
    </insert>

    <update id="updateTgjjGrxx" parameterType="TgjjGrxx">
        update tgjj_grxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="GRZH != null and GRZH != ''">GRZH = #{GRZH},</if>
            <if test="XINGMING != null">XINGMING = #{XINGMING},</if>
            <if test="XMQP != null">XMQP = #{XMQP},</if>
            <if test="XINGBIE != null">XINGBIE = #{XINGBIE},</if>
            <if test="GDDHHM != null">GDDHHM = #{GDDHHM},</if>
            <if test="SJHM != null">SJHM = #{SJHM},</if>
            <if test="ZJLX != null">ZJLX = #{ZJLX},</if>
            <if test="ZJHM != null">ZJHM = #{ZJHM},</if>
            <if test="CSNY != null">CSNY = #{CSNY},</if>
            <if test="HYZK != null">HYZK = #{HYZK},</if>
            <if test="ZHIYE != null">ZHIYE = #{ZHIYE},</if>
            <if test="ZHICHEN != null">ZHICHEN = #{ZHICHEN},</if>
            <if test="ZHIWU != null">ZHIWU = #{ZHIWU},</if>
            <if test="XUELI != null">XUELI = #{XUELI},</if>
            <if test="YZBM != null">YZBM = #{YZBM},</if>
            <if test="JTZZ != null">JTZZ = #{JTZZ},</if>
            <if test="JTYSR != null">JTYSR = #{JTYSR},</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="deleteTgjjGrxxById" parameterType="Long">
        delete from tgjj_grxx where ID = #{ID}
    </delete>

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

</mapper>