zoukankan      html  css  js  c++  java
  • mybatis批量更新表setting parameters 错误

    mybatis中想用 foreach标签 批量update set表
    下面是mapper.xml

    <update id="updateMonitorById" parameterType="java.util.List">
            <foreach collection="list" item="bean" index="index" open="" close="" separator=";">
                UPDATE dt_monitor
                <set>
                    account_name = #{bean.companyAccount},
                    sip_name = #{bean.sipName}
                </set>
                <where>
                    company_id = #{bean.companyId}
                </where>
                ORDER BY update_time desc limit 1
            </foreach>
    </update>
    

    传入的List数量大于1的时候就报错。
    后来发现是数据库配置的原因
    在配置数据库连接地址中加上
    &allowMultiQueries=true

    jdbcDriver=com.mysql.jdbc.Driver
    jdbcUrl=jdbc:mysql:///cake?characterEncoding=utf-8&allowMultiQueries=true
    jdbcusername=root
    jdbcpassword=1
    
  • 相关阅读:
    平时十二测
    无题十四
    暑假第十测
    无题十三
    noip错题集
    无题十二
    BZOJ整理
    志愿者招募
    修车
    任务安排
  • 原文地址:https://www.cnblogs.com/magicya/p/11545024.html
Copyright © 2011-2022 走看看