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