Browse Source

新增getActiveSourceId

zhouhao 8 năm trước cách đây
mục cha
commit
c0463359c6

+ 8 - 0
hsweb-web-core/src/main/java/org/hsweb/web/core/datasource/DataSourceHolder.java

@@ -49,6 +49,14 @@ public class DataSourceHolder {
         return defaultDataSource;
     }
 
+    public static String getActiveSourceId() {
+        if (DynamicDataSource.getActiveDataSourceId() != null) {
+            return DynamicDataSource.getActiveDataSourceId();
+        }
+        return "default";
+    }
+
+
     public static DatabaseType getActiveDatabaseType() {
         if (dynamicDataSource != null) {
             return dynamicDataSource.getActiveDataBaseType();