<?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.energystorageoverview.mapper.TEnergyStorageOverviewMapper">
    
    <resultMap type="TEnergyStorageOverview" id="TEnergyStorageOverviewResult">
        <result property="id"    column="id"    />
        <result property="dataTime"    column="data_time"    />
        <result property="zcdl"    column="zcdl"    />
        <result property="zfdl"    column="zfdl"    />
        <result property="ljcdcs"    column="ljcdcs"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
    </resultMap>

    <sql id="selectTEnergyStorageOverviewVo">
        select id, data_time, zcdl, zfdl, ljcdcs, create_time, create_by from t_energy_storage_overview
    </sql>

    <select id="selectTEnergyStorageOverviewList" parameterType="TEnergyStorageOverview" resultMap="TEnergyStorageOverviewResult">
        <include refid="selectTEnergyStorageOverviewVo"/>
        <where>  
            <if test="dataTime != null  and dataTime != ''"> and data_time = #{dataTime}</if>
            <if test="zcdl != null "> and zcdl = #{zcdl}</if>
            <if test="zfdl != null "> and zfdl = #{zfdl}</if>
            <if test="ljcdcs != null "> and ljcdcs = #{ljcdcs}</if>
        </where>
    </select>
    
    <select id="selectTEnergyStorageOverviewById" parameterType="Long" resultMap="TEnergyStorageOverviewResult">
        <include refid="selectTEnergyStorageOverviewVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTEnergyStorageOverview" parameterType="TEnergyStorageOverview" useGeneratedKeys="true" keyProperty="id">
        insert into t_energy_storage_overview
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dataTime != null">data_time,</if>
            <if test="zcdl != null">zcdl,</if>
            <if test="zfdl != null">zfdl,</if>
            <if test="ljcdcs != null">ljcdcs,</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="zcdl != null">#{zcdl},</if>
            <if test="zfdl != null">#{zfdl},</if>
            <if test="ljcdcs != null">#{ljcdcs},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
         </trim>
    </insert>

    <update id="updateTEnergyStorageOverview" parameterType="TEnergyStorageOverview">
        update t_energy_storage_overview
        <trim prefix="SET" suffixOverrides=",">
            <if test="dataTime != null">data_time = #{dataTime},</if>
            <if test="zcdl != null">zcdl = #{zcdl},</if>
            <if test="zfdl != null">zfdl = #{zfdl},</if>
            <if test="ljcdcs != null">ljcdcs = #{ljcdcs},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTEnergyStorageOverviewById" parameterType="Long">
        delete from t_energy_storage_overview where id = #{id}
    </delete>

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

</mapper>