updateById 在启用了SASS并且是异步调用时取不到tenantId造成更新失败
版本号:
3.7.0
问题描述:
接口方法添加@Async后,调用updateById保存实体数据时取到的tenantId为0
错误截图:
Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@54df2b73] was not registered for synchronization because synchronization is not active JDBC Connection [ConnectionProxyImpl{connectedTime=2024-08-08 13:48:20.613, closeCount=0, lastValidateTimeMillis=2024-08-08 13:48:20.769}] will not be managed by Spring original SQL: UPDATE sample SET sample_no=?, sample_name=?, raw_data_file=?, analysis_model_id=?, analysis_chart=?, pca_plot=?, conclusion=?, sys_org_code=?, create_by=?, create_time=?, update_by=?, update_time=?, tenant_id=? WHERE id=? SQL to parse, SQL: UPDATE sample SET sample_no=?, sample_name=?, raw_data_file=?, analysis_model_id=?, analysis_chart=?, pca_plot=?, conclusion=?, sys_org_code=?, create_by=?, create_time=?, update_by=?, update_time=?, tenant_id=? WHERE id=? parse the finished SQL: UPDATE sample SET sample_no = ?, sample_name = ?, raw_data_file = ?, analysis_model_id = ?, analysis_chart = ?, pca_plot = ?, conclusion = ?, sys_org_code = ?, create_by = ?, create_time = ?, update_by = ?, update_time = ?, tenant_id = ? WHERE id = ? AND tenant_id = 0 ==> Preparing: UPDATE sample SET sample_no = ?, sample_name = ?, raw_data_file = ?, analysis_model_id = ?, analysis_chart = ?, pca_plot = ?, conclusion = ?, sys_org_code = ?, create_by = ?, create_time = ?, update_by = ?, update_time = ?, tenant_id = ? WHERE id = ? AND tenant_id = 0 ==> Parameters: RG173-2(String), RG173-2(String), temp/RG173-21722513701709.csv(String), 1724264686739726337(String), temp/1818980419708252162.png(String), temp/1818980419708252162pca.png(String), ����������(String), A05(String), doctor_su(String), 2024-08-01 20:01:42.0(Timestamp), doctor_su(String), 2024-08-08 13:49:01.949(Timestamp), 1008(Integer), 1818980419708252162(String) <== Updates: 0 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@54df2b73] false
友情提示:
- 未按格式要求发帖、描述过于简单的,会被直接删掉;
- 描述问题请图文并茂,方便我们理解并快速定位问题;
- 如果使用的不是master,请说明你使用的分支;