From 03b5b8a480fb201e288486299eb385a00d2aac66 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期一, 13 十月 2025 09:25:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/ycawdasrs-2' into ycawdasrs-2
---
src/main/java/com/zy/common/config/ds/DataSourceType.java | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/zy/common/config/ds/DataSourceType.java b/src/main/java/com/zy/common/config/ds/DataSourceType.java
new file mode 100644
index 0000000..57ce62b
--- /dev/null
+++ b/src/main/java/com/zy/common/config/ds/DataSourceType.java
@@ -0,0 +1,32 @@
+package com.zy.common.config.ds;
+
+public class DataSourceType {
+
+ public enum DataBaseType {
+ TEST01, TEST02
+ }
+
+ // 浣跨敤ThreadLocal淇濊瘉绾跨▼瀹夊叏
+ private static final ThreadLocal<DataBaseType> TYPE = new ThreadLocal<DataBaseType>();
+
+ // 寰�褰撳墠绾跨▼閲岃缃暟鎹簮绫诲瀷
+ public static void setDataBaseType(DataBaseType dataBaseType) {
+ if (dataBaseType == null) {
+ throw new NullPointerException();
+ }
+ //System.err.println("[灏嗗綋鍓嶆暟鎹簮鏀逛负]锛�" + dataBaseType);
+ TYPE.set(dataBaseType);
+ }
+
+ // 鑾峰彇鏁版嵁婧愮被鍨�
+ public static DataBaseType getDataBaseType() {
+ DataBaseType dataBaseType = TYPE.get() == null ? DataBaseType.TEST01 : TYPE.get();
+ //System.err.println("[鑾峰彇褰撳墠鏁版嵁婧愮殑绫诲瀷涓篯锛�" + dataBaseType);
+ return dataBaseType;
+ }
+
+ // 娓呯┖鏁版嵁绫诲瀷
+ public static void clearDataBaseType() {
+ TYPE.remove();
+ }
+}
--
Gitblit v1.9.1