<?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.evobms.project.bms.mapper.BmsSopDataMapper">
    <resultMap type="com.evobms.project.bms.domain.BmsSopData" id="BmsSopDataResult">
        <result property="id" column="id"/>
        <result property="deviceId" column="device_id"/>
        <result property="timestamp" column="timestamp"/>
        <result property="dischargeSop10s" column="discharge_sop_10s"/>
        <result property="dischargeSop30s" column="discharge_sop_30s"/>
        <result property="dischargeSop60s" column="discharge_sop_60s"/>
        <result property="dischargeSopContinuous" column="discharge_sop_continuous"/>
        <result property="regenSop10s" column="regen_sop_10s"/>
        <result property="regenSop30s" column="regen_sop_30s"/>
        <result property="regenSop60s" column="regen_sop_60s"/>
        <result property="regenSopContinuous" column="regen_sop_continuous"/>
        <result property="chargeSop" column="charge_sop"/>
        <result property="acChargeSop" column="ac_charge_sop"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateBy" column="update_by"/>
    </resultMap>

    <insert id="insertBmsSopData" parameterType="com.evobms.project.bms.domain.BmsSopData" useGeneratedKeys="true" keyProperty="id">
        insert into bms_sop_data
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="deviceId != null and deviceId != ''">device_id,</if>
            <if test="timestamp != null">timestamp,</if>
            <if test="dischargeSop10s != null">discharge_sop_10s,</if>
            <if test="dischargeSop30s != null">discharge_sop_30s,</if>
            <if test="dischargeSop60s != null">discharge_sop_60s,</if>
            <if test="dischargeSopContinuous != null">discharge_sop_continuous,</if>
            <if test="regenSop10s != null">regen_sop_10s,</if>
            <if test="regenSop30s != null">regen_sop_30s,</if>
            <if test="regenSop60s != null">regen_sop_60s,</if>
            <if test="regenSopContinuous != null">regen_sop_continuous,</if>
            <if test="chargeSop != null">charge_sop,</if>
            <if test="acChargeSop != null">ac_charge_sop,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="deviceId != null and deviceId != ''">#{deviceId},</if>
            <if test="timestamp != null">#{timestamp},</if>
            <if test="dischargeSop10s != null">#{dischargeSop10s},</if>
            <if test="dischargeSop30s != null">#{dischargeSop30s},</if>
            <if test="dischargeSop60s != null">#{dischargeSop60s},</if>
            <if test="dischargeSopContinuous != null">#{dischargeSopContinuous},</if>
            <if test="regenSop10s != null">#{regenSop10s},</if>
            <if test="regenSop30s != null">#{regenSop30s},</if>
            <if test="regenSop60s != null">#{regenSop60s},</if>
            <if test="regenSopContinuous != null">#{regenSopContinuous},</if>
            <if test="chargeSop != null">#{chargeSop},</if>
            <if test="acChargeSop != null">#{acChargeSop},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
        </trim>
    </insert>
</mapper>
