<?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.lotuscbcjl.mapper.TLotusCbcjlMapper">
    
    <resultMap type="TLotusCbcjl" id="TLotusCbcjlResult">
        <result property="id"    column="id"    />
        <result property="scsj"    column="scsj"    />
        <result property="ycsj"    column="ycsj"    />
        <result property="sbsj"    column="sbsj"    />
        <result property="bfb"    column="bfb"    />
        <result property="dateTime"    column="date_time"    />
    </resultMap>

    <sql id="selectTLotusCbcjlVo">
        select id, scsj, ycsj, sbsj, bfb, date_time from t_lotus_cbcjl
    </sql>

    <select id="selectTLotusCbcjlList" parameterType="TLotusCbcjl" resultMap="TLotusCbcjlResult">
        <include refid="selectTLotusCbcjlVo"/>
        <where>  
            <if test="scsj != null "> and scsj = #{scsj}</if>
            <if test="ycsj != null "> and ycsj = #{ycsj}</if>
            <if test="sbsj != null "> and sbsj = #{sbsj}</if>
            <if test="bfb != null "> and bfb = #{bfb}</if>
            <if test="dateTime != null  and dateTime != ''"> and date_time = #{dateTime}</if>
        </where>
    </select>
    
    <select id="selectTLotusCbcjlById" parameterType="Long" resultMap="TLotusCbcjlResult">
        <include refid="selectTLotusCbcjlVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTLotusCbcjl" parameterType="TLotusCbcjl" useGeneratedKeys="true" keyProperty="id">
        insert into t_lotus_cbcjl
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="scsj != null">scsj,</if>
            <if test="ycsj != null">ycsj,</if>
            <if test="sbsj != null">sbsj,</if>
            <if test="bfb != null">bfb,</if>
            <if test="dateTime != null">date_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="scsj != null">#{scsj},</if>
            <if test="ycsj != null">#{ycsj},</if>
            <if test="sbsj != null">#{sbsj},</if>
            <if test="bfb != null">#{bfb},</if>
            <if test="dateTime != null">#{dateTime},</if>
         </trim>
    </insert>

    <update id="updateTLotusCbcjl" parameterType="TLotusCbcjl">
        update t_lotus_cbcjl
        <trim prefix="SET" suffixOverrides=",">
            <if test="scsj != null">scsj = #{scsj},</if>
            <if test="ycsj != null">ycsj = #{ycsj},</if>
            <if test="sbsj != null">sbsj = #{sbsj},</if>
            <if test="bfb != null">bfb = #{bfb},</if>
            <if test="dateTime != null">date_time = #{dateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTLotusCbcjlById" parameterType="Long">
        delete from t_lotus_cbcjl where id = #{id}
    </delete>

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

</mapper>