Java-mybatis-一次执行多条SQL语句
mysql数据库
1、修改数据库连接参数加上allowMultiQueries=true,如:
hikariConfig.security.jdbcUrl=jdbc:mysql://xx.xx.xx:3306/xxxxx?characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true
2、直接写多条语句,用“;”隔开即可
<delete id="deleteUserById" parameterType="String">
delete from user_role where id=#{id};
delete from user where userId=#{id};
</delete>