MyBatis的Mapper.xml怎么同时执行多个sql语句
1个回答
展开全部
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 sec_user_role where userId=#{id};
delete from sec_user where id=#{id};
</delete>
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 sec_user_role where userId=#{id};
delete from sec_user where id=#{id};
</delete>
TableDI
2024-07-18 广告
2024-07-18 广告
仅需3步!不写公式自动完成Excel vlookup表格匹配!Excel在线免,vlookup工具,点击30步自动完成表格匹配,无需手写公式,免费使用!...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询