<?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.TgjjDwzhxxMapper">
    
    <resultMap type="TgjjDwzhxx" id="TgjjDwzhxxResult">
        <result property="ID"    column="ID"    />
        <result property="DWZH"    column="DWZH"    />
        <result property="DWJCBL"    column="DWJCBL"    />
        <result property="GRJCBL"    column="GRJCBL"    />
        <result property="DWJCRS"    column="DWJCRS"    />
        <result property="DWFCRS"    column="DWFCRS"    />
        <result property="DWZHYE"    column="DWZHYE"    />
        <result property="DWXHRQ"    column="DWXHRQ"    />
        <result property="DWXHYY"    column="DWXHYY"    />
        <result property="DWZHZT"    column="DWZHZT"    />
        <result property="JZNY"    column="JZNY"    />
        <result property="ZXBH"    column="ZXBH"    />
        <result property="lastUpdateTime"    column="LAST_UPDATE_TIME"    />
        <result property="CLLX"    column="CLLX"    />
    </resultMap>

    <sql id="selectTgjjDwzhxxVo">
        select ID, DWZH, DWJCBL, GRJCBL, DWJCRS, DWFCRS, DWZHYE, DWXHRQ, DWXHYY, DWZHZT, JZNY, ZXBH, LAST_UPDATE_TIME, CLLX from tgjj_dwzhxx
    </sql>

    <select id="selectTgjjDwzhxxList" parameterType="TgjjDwzhxx" resultMap="TgjjDwzhxxResult">
        <include refid="selectTgjjDwzhxxVo"/>
        <where>  
            <if test="DWZH != null  and DWZH != ''"> and DWZH = #{DWZH}</if>
            <if test="DWJCBL != null "> and DWJCBL = #{DWJCBL}</if>
            <if test="GRJCBL != null "> and GRJCBL = #{GRJCBL}</if>
            <if test="DWJCRS != null "> and DWJCRS = #{DWJCRS}</if>
            <if test="DWFCRS != null "> and DWFCRS = #{DWFCRS}</if>
            <if test="DWZHYE != null "> and DWZHYE = #{DWZHYE}</if>
            <if test="DWXHRQ != null "> and DWXHRQ = #{DWXHRQ}</if>
            <if test="DWXHYY != null  and DWXHYY != ''"> and DWXHYY = #{DWXHYY}</if>
            <if test="DWZHZT != null  and DWZHZT != ''"> and DWZHZT = #{DWZHZT}</if>
            <if test="JZNY != null  and JZNY != ''"> and JZNY = #{JZNY}</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="selectTgjjDwzhxxById" parameterType="Long" resultMap="TgjjDwzhxxResult">
        <include refid="selectTgjjDwzhxxVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTgjjDwzhxx" parameterType="TgjjDwzhxx" useGeneratedKeys="true" keyProperty="ID">
        insert into tgjj_dwzhxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="DWZH != null">DWZH,</if>
            <if test="DWJCBL != null">DWJCBL,</if>
            <if test="GRJCBL != null">GRJCBL,</if>
            <if test="DWJCRS != null">DWJCRS,</if>
            <if test="DWFCRS != null">DWFCRS,</if>
            <if test="DWZHYE != null">DWZHYE,</if>
            <if test="DWXHRQ != null">DWXHRQ,</if>
            <if test="DWXHYY != null">DWXHYY,</if>
            <if test="DWZHZT != null">DWZHZT,</if>
            <if test="JZNY != null">JZNY,</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="DWJCBL != null">#{DWJCBL},</if>
            <if test="GRJCBL != null">#{GRJCBL},</if>
            <if test="DWJCRS != null">#{DWJCRS},</if>
            <if test="DWFCRS != null">#{DWFCRS},</if>
            <if test="DWZHYE != null">#{DWZHYE},</if>
            <if test="DWXHRQ != null">#{DWXHRQ},</if>
            <if test="DWXHYY != null">#{DWXHYY},</if>
            <if test="DWZHZT != null">#{DWZHZT},</if>
            <if test="JZNY != null">#{JZNY},</if>
            <if test="ZXBH != null">#{ZXBH},</if>
            <if test="lastUpdateTime != null">#{lastUpdateTime},</if>
            <if test="CLLX != null">#{CLLX},</if>
         </trim>
    </insert>

    <update id="updateTgjjDwzhxx" parameterType="TgjjDwzhxx">
        update tgjj_dwzhxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="DWZH != null">DWZH = #{DWZH},</if>
            <if test="DWJCBL != null">DWJCBL = #{DWJCBL},</if>
            <if test="GRJCBL != null">GRJCBL = #{GRJCBL},</if>
            <if test="DWJCRS != null">DWJCRS = #{DWJCRS},</if>
            <if test="DWFCRS != null">DWFCRS = #{DWFCRS},</if>
            <if test="DWZHYE != null">DWZHYE = #{DWZHYE},</if>
            <if test="DWXHRQ != null">DWXHRQ = #{DWXHRQ},</if>
            <if test="DWXHYY != null">DWXHYY = #{DWXHYY},</if>
            <if test="DWZHZT != null">DWZHZT = #{DWZHZT},</if>
            <if test="JZNY != null">JZNY = #{JZNY},</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="deleteTgjjDwzhxxById" parameterType="Long">
        delete from tgjj_dwzhxx where ID = #{ID}
    </delete>

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

</mapper>