1. TestMapper
// 批量修改
int updateBatch(@Param("id") int[] id, String test);
2. TestMapper.xml
<update id="updateBatch">
UPDATE table_name
SET test = #{1}
WHERE id IN
<foreach collection="id" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
3. 调用
int[] id = new int[]{1, 2, 3};
updateBatch(id, "test");
// 相当于执行如下 sql 语句 :
// UPDATE table_name SET test = 'test' WHERE id IN (1,2,3)