mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
fix: 使用默认数据源获取 dsName 为 null 的错误。
This commit is contained in:
parent
ab9f1655a0
commit
8e7ab9dca3
@ -16,6 +16,7 @@
|
||||
package com.mybatisflex.core.audit;
|
||||
|
||||
import com.mybatisflex.core.FlexConsts;
|
||||
import com.mybatisflex.core.FlexGlobalConfig;
|
||||
import com.mybatisflex.core.datasource.DataSourceKey;
|
||||
import com.mybatisflex.core.util.StringUtil;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
@ -102,9 +103,12 @@ public class AuditManager {
|
||||
return supplier.execute();
|
||||
}
|
||||
String key = DataSourceKey.get();
|
||||
if (StringUtil.isNotBlank(key)) {
|
||||
auditMessage.setDsName(key);
|
||||
if (StringUtil.isBlank(key)) {
|
||||
key = FlexGlobalConfig.getDefaultConfig()
|
||||
.getDataSource()
|
||||
.getDefaultDataSourceKey();
|
||||
}
|
||||
auditMessage.setDsName(key);
|
||||
auditMessage.setQueryTime(clock.getTick());
|
||||
try {
|
||||
T result = supplier.execute();
|
||||
|
||||
@ -96,7 +96,7 @@ public class AuditMessage implements Serializable {
|
||||
private long elapsedTime;
|
||||
|
||||
/**
|
||||
* 数据库名称
|
||||
* 数据库名称。
|
||||
*/
|
||||
private String dsName;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user