在Idea中执行多条sql语句的修改(mybatis默认的是执行sql语句是执行单条,所以要执行多条的时候需要进行配置)

需要在连接字符串中添加上&allowMultiQueries=true,例如:

spring.datasource.url=jdbc:mysql://localhost:3306/plantform?characterEncoding=utf8&useSSL=true&allowMultiQueries=true
不添加这个的时候执行会出错
执行多条修改的方法(.xml配置)
<update id="UpdateList">
            <foreach collection="list" item="item" separator=";">
                    UPDATE 表名
                    set 列名1=#{item.列名1数据对应实体字段},
                    列名2=#{item.列名2数据对应实体字段}
                    where phone=#{item.查询条件}
            </foreach>
</update>
UpdateList

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-03-10
  • 2022-12-23
  • 2022-02-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-20
  • 2021-05-21
  • 2021-10-19
相关资源
相似解决方案