mybatis batch modification (use case when to build batch update)

<update id="updateBatch">
        UPDATE cms_student_outline set  version_id = case chapter_id
        <foreach collection="list" item="item" separator="">
        when #{item.chapterId} then #{item.versionId}
        </foreach>
        END
        WHERE id IN
        <foreach collection="list" item="item" open="(" separator="," close=")">
            #{item.id}
        </foreach>
</update>

Guess you like

Origin blog.csdn.net/qq_38410795/article/details/132110180