<?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.ztmap.project.zhny.netswdl.mapper.TNetSwdlMapper">
    
    <resultMap type="TNetSwdl" id="TNetSwdlResult">
        <result property="id"    column="id"    />
        <result property="data"    column="data"    />
        <result property="dataTime"    column="data_time"    />
    </resultMap>

    <sql id="selectTNetSwdlVo">
        select id, data, data_time from t_net_swdl
    </sql>

    <select id="selectTNetSwdlList" parameterType="TNetSwdl" resultMap="TNetSwdlResult">
        <include refid="selectTNetSwdlVo"/>
        <where>  
            <if test="data != null "> and data = #{data}</if>
            <if test="dataTime != null  and dataTime != ''"> and data_time = #{dataTime}</if>
        </where>
    </select>
    
    <select id="selectTNetSwdlById" parameterType="Long" resultMap="TNetSwdlResult">
        <include refid="selectTNetSwdlVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTNetSwdl" parameterType="TNetSwdl" useGeneratedKeys="true" keyProperty="id">
        insert into t_net_swdl
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="data != null">data,</if>
            <if test="dataTime != null">data_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="data != null">#{data},</if>
            <if test="dataTime != null">#{dataTime},</if>
         </trim>
    </insert>

    <update id="updateTNetSwdl" parameterType="TNetSwdl">
        update t_net_swdl
        <trim prefix="SET" suffixOverrides=",">
            <if test="data != null">data = #{data},</if>
            <if test="dataTime != null">data_time = #{dataTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTNetSwdlById" parameterType="Long">
        delete from t_net_swdl where id = #{id}
    </delete>

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

</mapper>