<?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.energystoragecncfdl.mapper.TEnergyStorageCncfdlMapper">
    
    <resultMap type="TEnergyStorageCncfdl" id="TEnergyStorageCncfdlResult">
        <result property="id"    column="id"    />
        <result property="dataTime"    column="data_time"    />
        <result property="fdl"    column="fdl"    />
        <result property="cdl"    column="cdl"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
    </resultMap>

    <sql id="selectTEnergyStorageCncfdlVo">
        select id, data_time, fdl, cdl, create_time, create_by from t_energy_storage_cncfdl
    </sql>

    <select id="selectTEnergyStorageCncfdlList" parameterType="TEnergyStorageCncfdl" resultMap="TEnergyStorageCncfdlResult">
        <include refid="selectTEnergyStorageCncfdlVo"/>
        <where>  
            <if test="dataTime != null  and dataTime != ''"> and data_time = #{dataTime}</if>
            <if test="fdl != null "> and fdl = #{fdl}</if>
            <if test="cdl != null "> and cdl = #{cdl}</if>
        </where>
    </select>
    
    <select id="selectTEnergyStorageCncfdlById" parameterType="Long" resultMap="TEnergyStorageCncfdlResult">
        <include refid="selectTEnergyStorageCncfdlVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTEnergyStorageCncfdl" parameterType="TEnergyStorageCncfdl" useGeneratedKeys="true" keyProperty="id">
        insert into t_energy_storage_cncfdl
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dataTime != null">data_time,</if>
            <if test="fdl != null">fdl,</if>
            <if test="cdl != null">cdl,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="dataTime != null">#{dataTime},</if>
            <if test="fdl != null">#{fdl},</if>
            <if test="cdl != null">#{cdl},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
         </trim>
    </insert>

    <update id="updateTEnergyStorageCncfdl" parameterType="TEnergyStorageCncfdl">
        update t_energy_storage_cncfdl
        <trim prefix="SET" suffixOverrides=",">
            <if test="dataTime != null">data_time = #{dataTime},</if>
            <if test="fdl != null">fdl = #{fdl},</if>
            <if test="cdl != null">cdl = #{cdl},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTEnergyStorageCncfdlById" parameterType="Long">
        delete from t_energy_storage_cncfdl where id = #{id}
    </delete>

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

</mapper>