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>
posted @ 2017-04-02 16:38  bjlhx15  阅读(1109)  评论(0编辑  收藏  举报
Copyright ©2011~2020 JD-李宏旭