插入
<insert id="batchSave" parameterType="java.util.List">
INSERT INTO T_UPLOAD_CELL_DATA (CELL_SN, PRODUCT_SN, TEST_DATE,
VOLTAGE_VALUE)
SELECT A.*
FROM(
<foreach collection="list" item="item" index="index"
separator="UNION ALL">
SELECT
#{item.cellSn} CELL_SN,
#{item.productSn} PRODUCT_SN,
#{item.testDate} TEST_DATE,
#{item.voltageValue} VOLTAGE_VALUE
FROM
dual
</foreach>
)A
</insert>
更新
<update id="batchUpdate" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="begin"
close=";end;" separator=";">
update T_UPLOAD_CELL_DATA t
set
t.PRODUCT_SN=#{item.productSn},
t.TEST_DATE=#{item.testDate},
t.VOLTAGE_VALUE=#{item.voltageValue}
where t.CELL_SN = #{item.cellSn}
</foreach>
</update>