<?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.lotusydqs.mapper.TLotusYdqsMapper">
    
    <resultMap type="TLotusYdqs" id="TLotusYdqsResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="data"    column="data"    />
        <result property="dataTime"    column="data_time"    />
    </resultMap>

    <sql id="selectTLotusYdqsVo">
        select id, name, data, data_time from t_lotus_ydqs
    </sql>

    <select id="selectTLotusYdqsList" parameterType="TLotusYdqs" resultMap="TLotusYdqsResult">
        <include refid="selectTLotusYdqsVo"/>
        <where>  
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="data != null "> and data = #{data}</if>
            <if test="dataTime != null  and dataTime != ''"> and data_time = #{dataTime}</if>
        </where>
    </select>
    
    <select id="selectTLotusYdqsById" parameterType="Long" resultMap="TLotusYdqsResult">
        <include refid="selectTLotusYdqsVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTLotusYdqs" parameterType="TLotusYdqs" useGeneratedKeys="true" keyProperty="id">
        insert into t_lotus_ydqs
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="name != null">name,</if>
            <if test="data != null">data,</if>
            <if test="dataTime != null">data_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="name != null">#{name},</if>
            <if test="data != null">#{data},</if>
            <if test="dataTime != null">#{dataTime},</if>
         </trim>
    </insert>

    <update id="updateTLotusYdqs" parameterType="TLotusYdqs">
        update t_lotus_ydqs
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">name = #{name},</if>
            <if test="data != null">data = #{data},</if>
            <if test="dataTime != null">data_time = #{dataTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTLotusYdqsById" parameterType="Long">
        delete from t_lotus_ydqs where id = #{id}
    </delete>

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

</mapper>