wangwei 7 vuotta sitten
vanhempi
commit
01146c7cd0

+ 61 - 0
examcloud-task-starter/src/main/java/cn/com/qmth/examcloud/task/starter/config/DataSourcesHolder.java

@@ -0,0 +1,61 @@
+package cn.com.qmth.examcloud.task.starter.config;
+
+import javax.sql.DataSource;
+
+import cn.com.qmth.examcloud.commons.base.util.DBUtil;
+
+/**
+ * 数据源
+ *
+ * @author WANGWEI
+ * @date 2018年8月3日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class DataSourcesHolder {
+
+	public enum DataSourceName {
+		/**
+		 * 基础信息
+		 */
+		CORE_BASIC("$ds.core.basic"),
+		/**
+		 * 考务
+		 */
+		CORE_EXAMWORK("$ds.core.examwork"),
+		/**
+		 * 题库
+		 */
+		CORE_QUESTION("$ds.core.question"),
+		/**
+		 * 阅卷
+		 */
+		CORE_MARKING("$ds.core.marking"),
+		/**
+		 * 网考
+		 */
+		CORE_OE("$ds.core.oe");
+
+		private String configName;
+
+		private DataSourceName(String configName) {
+			this.configName = configName;
+		}
+
+		public String getConfigName() {
+			return configName;
+		}
+
+	}
+
+	/**
+	 * 获取数据源
+	 *
+	 * @author WANGWEI
+	 * @param dataSourceName
+	 * @return
+	 */
+	public static DataSource getDataSource(DataSourceName dataSourceName) {
+		return DBUtil.getDataSource(dataSourceName.getConfigName());
+	}
+
+}