在配置文件的连接字符串中加入:allowMultiQueries=true
如下:
spring.datasource.driverClassName=org.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test?allowMultiQueries=true spring.datasource.username=root spring.datasource.password=123456
在mapper.xml中,即可如下方式,在一个函数调用过程中执行多条sql语句
insert into ttt(name) VALUES(#{name, jdbcType=VARCHAR}); insert into www(name) VALUES(#{name, jdbcType=VARCHAR});



