mysql批量更新|mybatis批量操作

新搭建一个项目spring boot + mybatis + mysql
【mysql批量更新|mybatis批量操作】批量更新操作一直报错,错误如下:
mysql批量更新|mybatis批量操作
文章图片

### The error may involve com.test.dao.test.ITestDao.batchUpdateTest-Inline
### The error occurred while setting parameters
### SQL: UPDATE t_test
SET test_num = ?,update_time = ?, update_user = ?
WHERE
test_id = ?;
UPDATE t_test
SET test_num = ?, update_time = ?, update_user = ?
WHERE
test_id = ?;
UPDATE t_test
SET test_num = ?, update_time = ?, update_user = ?
WHERE
test_id = ?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update t_test
SET test_num = 25,

' at line 14
一直以为是拼装的SQL语句语法有问题,把拼装更新SQL语句放入到Navicat Premium 中执行又没有问题
搜索资料mysql批量更新需要手动设置:
只要在jdbc.url中加上以下内容就可以

allowMultiQueries=true

mysql批量更新|mybatis批量操作
文章图片

    推荐阅读