<?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.BmsSystemStatusMapper">
    <resultMap type="com.evobms.project.bms.domain.BmsSystemStatus" id="BmsSystemStatusResult">
        <result property="id" column="id"/>
        <result property="deviceId" column="device_id"/>
        <result property="timestamp" column="timestamp"/>
        <result property="relayStatus" column="relay_status"/>
        <result property="onaaccStatus" column="onaacc_status"/>
        <result property="resetCount" column="reset_count"/>
        <result property="cycleCount" column="cycle_count"/>
        <result property="sample25v" column="sample_25v"/>
        <result property="sample5v" column="sample_5v"/>
        <result property="cellCount" column="cell_count"/>
        <result property="tempSensorCount" column="temp_sensor_count"/>
        <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="insertBmsSystemStatus" parameterType="com.evobms.project.bms.domain.BmsSystemStatus" useGeneratedKeys="true" keyProperty="id">
        insert into bms_system_status
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="deviceId != null and deviceId != ''">device_id,</if>
            <if test="timestamp != null">`timestamp`,</if>
            <if test="relayStatus != null">relay_status,</if>
            <if test="onaaccStatus != null">onaacc_status,</if>
            <if test="resetCount != null">reset_count,</if>
            <if test="cycleCount != null">cycle_count,</if>
            <if test="sample25v != null">sample_25v,</if>
            <if test="sample5v != null">sample_5v,</if>
            <if test="cellCount != null">cell_count,</if>
            <if test="tempSensorCount != null">temp_sensor_count,</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="relayStatus != null">#{relayStatus},</if>
            <if test="onaaccStatus != null">#{onaaccStatus},</if>
            <if test="resetCount != null">#{resetCount},</if>
            <if test="cycleCount != null">#{cycleCount},</if>
            <if test="sample25v != null">#{sample25v},</if>
            <if test="sample5v != null">#{sample5v},</if>
            <if test="cellCount != null">#{cellCount},</if>
            <if test="tempSensorCount != null">#{tempSensorCount},</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>
