<?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.pwt.web.mapper.PwtHolderBatteryStateCacheMapper">

    <resultMap id="batteryStateCache" type="PwtHolderBatteryStateCache">
        <result property="holderId" column="holder_id" />
        <result property="batterySn" column="battery_sn" />
        <result property="ratedCapacity" column="rated_capacity" />
        <result property="soc" column="soc" />
        <result property="updateTime" column="update_time" />
    </resultMap>

    <update id="updateBatteryStateCacheRecord" parameterType="PwtHolderBatteryStateCache">
        update pwt_holder_battery_state_cache
        <trim prefix="SET" suffixOverrides=",">
            battery_sn = #{batterySn},
            rated_capacity = #{ratedCapacity},
            soc = #{soc},
            update_time = #{updateTime}
        </trim>
        where holder_id = #{holderId}
    </update>

    <select id="getBatteryStateCacheMap" resultMap="batteryStateCache">
        select * from pwt_holder_battery_state_cache where battery_sn is not null;
    </select>
</mapper>