<?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.energystoragecount.mapper.TEnergyStorageChargeCountMapper">
    
    <resultMap type="TEnergyStorageChargeCount" id="TEnergyStorageChargeCountResult">
        <result property="id"    column="id"    />
        <result property="dataTime"    column="data_time"    />
        <result property="gf"    column="gf"    />
        <result property="fd"    column="fd"    />
        <result property="sd"    column="sd"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
    </resultMap>

    <sql id="selectTEnergyStorageChargeCountVo">
        select id, data_time, gf, fd, sd, create_time, create_by from t_energy_storage_charge_count
    </sql>

    <select id="selectTEnergyStorageChargeCountList" parameterType="TEnergyStorageChargeCount" resultMap="TEnergyStorageChargeCountResult">
        <include refid="selectTEnergyStorageChargeCountVo"/>
        <where>  
            <if test="dataTime != null  and dataTime != ''"> and data_time = #{dataTime}</if>
            <if test="gf != null "> and gf = #{gf}</if>
            <if test="fd != null "> and fd = #{fd}</if>
            <if test="sd != null "> and sd = #{sd}</if>
        </where>
    </select>
    
    <select id="selectTEnergyStorageChargeCountById" parameterType="Long" resultMap="TEnergyStorageChargeCountResult">
        <include refid="selectTEnergyStorageChargeCountVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTEnergyStorageChargeCount" parameterType="TEnergyStorageChargeCount" useGeneratedKeys="true" keyProperty="id">
        insert into t_energy_storage_charge_count
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dataTime != null">data_time,</if>
            <if test="gf != null">gf,</if>
            <if test="fd != null">fd,</if>
            <if test="sd != null">sd,</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="gf != null">#{gf},</if>
            <if test="fd != null">#{fd},</if>
            <if test="sd != null">#{sd},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
         </trim>
    </insert>

    <update id="updateTEnergyStorageChargeCount" parameterType="TEnergyStorageChargeCount">
        update t_energy_storage_charge_count
        <trim prefix="SET" suffixOverrides=",">
            <if test="dataTime != null">data_time = #{dataTime},</if>
            <if test="gf != null">gf = #{gf},</if>
            <if test="fd != null">fd = #{fd},</if>
            <if test="sd != null">sd = #{sd},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTEnergyStorageChargeCountById" parameterType="Long">
        delete from t_energy_storage_charge_count where id = #{id}
    </delete>

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

</mapper>