<?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.sundot.airport.exam.mapper.ExamRecOptMapper">
    <update id="updateEroConnNoBatch" parameterType="java.util.List">
        UPDATE `edu_cs_exam_rec_opt`
        <trim prefix="SET" suffixOverrides=",">
            <trim prefix="`ero_conn_no` = CASE" suffix="END,">
                <foreach collection="list" item="item" index="index">
                    WHEN `ero_id` = #{item.eroId} THEN #{item.eroConnNo}
                </foreach>
            </trim>
        </trim>
        <trim prefix="SET" suffixOverrides=",">
            <trim prefix="`ero_correct_status` = CASE" suffix="END,">
                <foreach collection="list" item="item" index="index">
                    WHEN `ero_id` = #{item.eroId} THEN #{item.eroCorrectStatusStr}
                </foreach>
            </trim>
        </trim>
        <trim prefix="SET" suffixOverrides=",">
            <trim prefix="`ero_correct_blank_idx` = CASE" suffix="END,">
                <foreach collection="list" item="item" index="index">
                    WHEN `ero_id` = #{item.eroId} THEN #{item.eroCorrectBlankIdx}
                </foreach>
            </trim>
        </trim>
        WHERE `ero_id` IN
        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
            #{item.eroId}
        </foreach>
    </update>
</mapper>
