Mybatis一次执行多个SQL

SET @update_id := 0;update sharding_seq set table_seq=(SELECT @update_id := table_seq+10) where table_name='md_sku_front_list';SELECT @update_id;
mybatis支持一次执行多条SQL,如上面所示。

但是需要注意的是连接数据库的url需要新增参数:allowMultiQueries=true

jdbc.jdbcUrl=jdbc:mysql://127.0.0.1:3306/database?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true

发布了57 篇原创文章 · 获赞 39 · 访问量 20万+

猜你喜欢

转载自blog.csdn.net/SJZYLC/article/details/90416360