错误信息:
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
当然从错误中并不能看到错误是在哪里。
解决步骤:
第一步:先将要批量执行的sql在数据库层执行以下查看是否真的有问题。经测试sql无问题。
第二步:然后在检查xml是否正确。再三确认无误。
最终发现需要批量更新时需要在数据库连接地址上加上allowMultiQueries=true该参数
最终数据库连接配置地址spring.datasource.url=jdbc:mysql://localhost:3306/xxxx?allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8