美文网首页
mybatis批量更新

mybatis批量更新

作者: 有梦想永远年轻 | 来源:发表于2019-06-13 14:52 被阅读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,表示允许批量操作

相关文章

网友评论

      本文标题:mybatis批量更新

      本文链接:https://www.haomeiwen.com/subject/shlsfctx.html