<?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.TgjjHmdxxMapper">
    
    <resultMap type="TgjjHmdxx" id="TgjjHmdxxResult">
        <result property="ID"    column="ID"    />
        <result property="BLJLID"    column="BLJLID"    />
        <result property="XINGMING"    column="XINGMING"    />
        <result property="ZJLX"    column="ZJLX"    />
        <result property="ZJHM"    column="ZJHM"    />
        <result property="BLXXFL"    column="BLXXFL"    />
        <result property="BLXXDJ"    column="BLXXDJ"    />
        <result property="BLXXZT"    column="BLXXZT"    />
        <result property="startTime"    column="START_TIME"    />
        <result property="endTime"    column="END_TIME"    />
        <result property="SYMS"    column="SYMS"    />
        <result property="ZXBH"    column="ZXBH"    />
        <result property="LXYQQS"    column="LXYQQS"    />
        <result property="lastUpdateTime"    column="LAST_UPDATE_TIME"    />
        <result property="CLLX"    column="CLLX"    />
    </resultMap>

    <sql id="selectTgjjHmdxxVo">
        select ID, BLJLID, XINGMING, ZJLX, ZJHM, BLXXFL, BLXXDJ, BLXXZT, START_TIME, END_TIME, SYMS, ZXBH, LXYQQS, LAST_UPDATE_TIME, CLLX from tgjj_hmdxx
    </sql>

    <select id="selectTgjjHmdxxList" parameterType="TgjjHmdxx" resultMap="TgjjHmdxxResult">
        <include refid="selectTgjjHmdxxVo"/>
        <where>  
            <if test="BLJLID != null  and BLJLID != ''"> and BLJLID = #{BLJLID}</if>
            <if test="XINGMING != null  and XINGMING != ''"> and XINGMING = #{XINGMING}</if>
            <if test="ZJLX != null  and ZJLX != ''"> and ZJLX = #{ZJLX}</if>
            <if test="ZJHM != null  and ZJHM != ''"> and ZJHM = #{ZJHM}</if>
            <if test="BLXXFL != null  and BLXXFL != ''"> and BLXXFL = #{BLXXFL}</if>
            <if test="BLXXDJ != null  and BLXXDJ != ''"> and BLXXDJ = #{BLXXDJ}</if>
            <if test="BLXXZT != null  and BLXXZT != ''"> and BLXXZT = #{BLXXZT}</if>
            <if test="startTime != null "> and START_TIME = #{startTime}</if>
            <if test="endTime != null "> and END_TIME = #{endTime}</if>
            <if test="SYMS != null  and SYMS != ''"> and SYMS = #{SYMS}</if>
            <if test="ZXBH != null  and ZXBH != ''"> and ZXBH = #{ZXBH}</if>
            <if test="LXYQQS != null "> and LXYQQS = #{LXYQQS}</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="selectTgjjHmdxxById" parameterType="Long" resultMap="TgjjHmdxxResult">
        <include refid="selectTgjjHmdxxVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTgjjHmdxx" parameterType="TgjjHmdxx" useGeneratedKeys="true" keyProperty="ID">
        insert into tgjj_hmdxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="BLJLID != null">BLJLID,</if>
            <if test="XINGMING != null">XINGMING,</if>
            <if test="ZJLX != null">ZJLX,</if>
            <if test="ZJHM != null">ZJHM,</if>
            <if test="BLXXFL != null">BLXXFL,</if>
            <if test="BLXXDJ != null">BLXXDJ,</if>
            <if test="BLXXZT != null">BLXXZT,</if>
            <if test="startTime != null">START_TIME,</if>
            <if test="endTime != null">END_TIME,</if>
            <if test="SYMS != null">SYMS,</if>
            <if test="ZXBH != null">ZXBH,</if>
            <if test="LXYQQS != null">LXYQQS,</if>
            <if test="lastUpdateTime != null">LAST_UPDATE_TIME,</if>
            <if test="CLLX != null">CLLX,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="BLJLID != null">#{BLJLID},</if>
            <if test="XINGMING != null">#{XINGMING},</if>
            <if test="ZJLX != null">#{ZJLX},</if>
            <if test="ZJHM != null">#{ZJHM},</if>
            <if test="BLXXFL != null">#{BLXXFL},</if>
            <if test="BLXXDJ != null">#{BLXXDJ},</if>
            <if test="BLXXZT != null">#{BLXXZT},</if>
            <if test="startTime != null">#{startTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="SYMS != null">#{SYMS},</if>
            <if test="ZXBH != null">#{ZXBH},</if>
            <if test="LXYQQS != null">#{LXYQQS},</if>
            <if test="lastUpdateTime != null">#{lastUpdateTime},</if>
            <if test="CLLX != null">#{CLLX},</if>
         </trim>
    </insert>

    <update id="updateTgjjHmdxx" parameterType="TgjjHmdxx">
        update tgjj_hmdxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="BLJLID != null">BLJLID = #{BLJLID},</if>
            <if test="XINGMING != null">XINGMING = #{XINGMING},</if>
            <if test="ZJLX != null">ZJLX = #{ZJLX},</if>
            <if test="ZJHM != null">ZJHM = #{ZJHM},</if>
            <if test="BLXXFL != null">BLXXFL = #{BLXXFL},</if>
            <if test="BLXXDJ != null">BLXXDJ = #{BLXXDJ},</if>
            <if test="BLXXZT != null">BLXXZT = #{BLXXZT},</if>
            <if test="startTime != null">START_TIME = #{startTime},</if>
            <if test="endTime != null">END_TIME = #{endTime},</if>
            <if test="SYMS != null">SYMS = #{SYMS},</if>
            <if test="ZXBH != null">ZXBH = #{ZXBH},</if>
            <if test="LXYQQS != null">LXYQQS = #{LXYQQS},</if>
            <if test="lastUpdateTime != null">LAST_UPDATE_TIME = #{lastUpdateTime},</if>
            <if test="CLLX != null">CLLX = #{CLLX},</if>
        </trim>
        where ID = #{ID}
    </update>

    <delete id="deleteTgjjHmdxxById" parameterType="Long">
        delete from tgjj_hmdxx where ID = #{ID}
    </delete>

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

</mapper>