<update id="batchUpdate" parameterType="java.util.List"> update user1 user1, ( <foreach collection="list" item="item" index="index" separator=" union all "> select #{item.id,jdbcType=BIGINT} as id, #{item.updateUserId,jdbcType=BIGINT} as user_id, #{item.updateUserName,jdbcType=VARCHAR} as user_name, #{item.recordVersion,jdbcType=INTEGER} as record_version </foreach> ) tt set user.user_id = tt.user_id, user.user_name = tt.user_name, user.update_date = now(), user.record_version = tt.record_version + 1 where user.id = tt.id and user.record_version = tt.record_version </update>