select battery_pack, battery_cluster, battery_cell_id, voltage, temperature, soc, soh, date_day, data_timestamp, create_by, create_time, update_by, update_time, remark, site_id, device_id, cluster_device_id from ems_battery_data_daily_latest
insert into ems_battery_data_daily_latest
battery_pack,
battery_cluster,
battery_cell_id,
voltage,
temperature,
soc,
soh,
date_day,
data_timestamp,
create_by,
create_time,
update_by,
update_time,
remark,
site_id,
device_id,
cluster_device_id,
#{batteryPack},
#{batteryCluster},
#{batteryCellId},
#{voltage},
#{temperature},
#{soc},
#{soh},
#{dateDay},
#{dataTimestamp},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
#{remark},
#{siteId},
#{deviceId},
#{clusterDeviceId},
update ems_battery_data_daily_latest
battery_cluster = #{batteryCluster},
battery_cell_id = #{batteryCellId},
voltage = #{voltage},
temperature = #{temperature},
soc = #{soc},
soh = #{soh},
date_day = #{dateDay},
data_timestamp = #{dataTimestamp},
create_by = #{createBy},
create_time = #{createTime},
update_by = #{updateBy},
update_time = #{updateTime},
remark = #{remark},
site_id = #{siteId},
device_id = #{deviceId},
cluster_device_id = #{clusterDeviceId},
where battery_pack = #{batteryPack}
delete from ems_battery_data_daily_latest where battery_pack = #{batteryPack}
delete from ems_battery_data_daily_latest where battery_pack in
#{batteryPack}
INSERT INTO ems_battery_data_daily_latest (
battery_pack, battery_cluster, battery_cell_id, voltage, temperature, soc, soh, date_day,
data_timestamp, create_by, create_time, update_by, update_time, remark, site_id, device_id, cluster_device_id
) VALUES
(
#{item.batteryPack},
#{item.batteryCluster},
#{item.batteryCellId},
#{item.voltage},
#{item.temperature},
#{item.soc},
#{item.soh},
#{item.dateDay},
#{item.dataTimestamp},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime},
#{item.remark},
#{item.siteId},
#{item.deviceId},
#{item.clusterDeviceId}
)
ON DUPLICATE KEY UPDATE
voltage = VALUES(voltage),
temperature = VALUES(temperature),
soc = VALUES(soc),
soh = VALUES(soh),
data_timestamp = VALUES(data_timestamp),
update_time = NOW(),
remark = VALUES(remark)