使用动态表名, //动态表名 DynamicTableNameInnerInterceptor dynamicTableNameInnerInterceptor = new DynamicTableNameInnerInterceptor(); dynamicTableNameInnerInterceptor.setTableNameHandler((sql, tableName) -> { // 获取参数方法 String name = tableName;
if (tableName.equals("double_ball_computer")) {
name = MybatisPlusConfig.tableName.get();
//name = "double_ball_computer_101731267527315456";
}
log.debug("RealSmile debug : sql==>{},tableName==>{},return ThreadLocal<String> tableName==>{}", sql, tableName, MybatisPlusConfig.tableName.get());
return name;
});
interceptor.addInnerInterceptor(dynamicTableNameInnerInterceptor);
打印日志,提示事务未开启 SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@679a539a] Transaction not enabled
Comment From: qmdx
不会的,这里只是对 sql 表名进行了修改
Comment From: realchencom
我是seata1.4.2、MyBatisplus3.4.3.4、springboot2.3.2,将动态表明去掉,事务正常提交,加上动态表明,事务无法正常提交。事务方法内使用jdbc也正常。发自我的荣耀手机-------- 原始邮件 --------发件人: qmdx @.>日期: 2021年10月13日周三 18:20收件人: baomidou/mybatis-plus @.>抄送: real @.>, Author @.>主 题: Re: [baomidou/mybatis-plus] 动态表名会影响事务吗,版本是3.4.3.4 (#3981)
不会的,这里只是对 sql 表名进行了修改
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
Comment From: qmdx
我是seata1.4.2、MyBatisplus3.4.3.4、springboot2.3.2,将动态表明去掉,事务正常提交,加上动态表明,事务无法正常提交。事务方法内使用jdbc也正常。发自我的荣耀手机-------- 原始邮件 --------发件人: qmdx @.>日期: 2021年10月13日周三 18:20收件人: baomidou/mybatis-plus @.>抄送: real @.>, Author @.>主 题: Re: [baomidou/mybatis-plus] 动态表名会影响事务吗,版本是3.4.3.4 (#3981) 不会的,这里只是对 sql 表名进行了修改 —You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
能否给出复现 demo
Comment From: huayanYu
无回复.关闭, 后续能给出复现demo可重提