mybatis批量更新

2019-06-13  本文已影响0人  有梦想永远年轻

  <update id="updateBatchData" parameterType="java.util.List">

        <foreach collection="list" item="bean" index="index" open="" close="" separator=";">

            UPDATE demo

            <set>

                name=#{bean.name}

            </set>

            <where>

                id= #{bean.id}

            </where>

        </foreach>

    </update>

注意: 必须在配置连接数据库url后面带一个参数 &allowMultiQueries=true,表示允许批量操作

上一篇 下一篇

猜你喜欢

热点阅读