From f9a23be8ceef76fe19aaff1a44aa213570b2f3d4 Mon Sep 17 00:00:00 2001
From: mrbird <852252810@qq.com>
Date: Wed, 2 May 2018 14:37:31 +0800
Subject: [PATCH] =?UTF-8?q?Spring=20Boot=20MyBatis=E9=85=8D=E7=BD=AEDruid?=
=?UTF-8?q?=E5=A4=9A=E6=95=B0=E6=8D=AE=E6=BA=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
5.Spring-Boot-MyBatis-MultiDataSource/pom.xml | 77 +++++++++++++++++++
.../main/java/com/springboot/Application.java | 13 ++++
.../controller/StudentController.java | 27 +++++++
.../datasource/MysqlDatasourceConfig.java | 51 ++++++++++++
.../datasource/OracleDatasourceConfig.java | 47 +++++++++++
.../mysqldao/MysqlStudentMapper.java | 10 +++
.../oracledao/OracleStudentMapper.java | 10 +++
.../springboot/service/StudentService.java | 9 +++
.../service/impl/StudentServiceImp.java | 30 ++++++++
.../src/main/resources/application.yml | 76 ++++++++++++++++++
.../mapper/mysql/MysqlStudentMapper.xml | 8 ++
.../mapper/oracle/OracleStudentMapper.xml | 8 ++
.../src/main/resources/mysql_sql.sql | 33 ++++++++
.../src/main/resources/oracle_sql.sql | 47 +++++++++++
14 files changed, 446 insertions(+)
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/pom.xml
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/Application.java
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/controller/StudentController.java
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/datasource/MysqlDatasourceConfig.java
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/datasource/OracleDatasourceConfig.java
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/mysqldao/MysqlStudentMapper.java
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/oracledao/OracleStudentMapper.java
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/service/StudentService.java
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/service/impl/StudentServiceImp.java
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/resources/application.yml
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/resources/mapper/mysql/MysqlStudentMapper.xml
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/resources/mapper/oracle/OracleStudentMapper.xml
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/resources/mysql_sql.sql
create mode 100644 5.Spring-Boot-MyBatis-MultiDataSource/src/main/resources/oracle_sql.sql
diff --git a/5.Spring-Boot-MyBatis-MultiDataSource/pom.xml b/5.Spring-Boot-MyBatis-MultiDataSource/pom.xml
new file mode 100644
index 0000000..76420c4
--- /dev/null
+++ b/5.Spring-Boot-MyBatis-MultiDataSource/pom.xml
@@ -0,0 +1,77 @@
+
+
+ 4.0.0
+
+ com.springboot
+ Spring-Boot-MyBatis-MultiDataSource
+ 1.0-snapshot
+ jar
+
+ demo
+ Demo project for Spring Boot
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.9.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.7
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 1.3.1
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+ com.oracle
+ ojdbc6
+ 6.0
+
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ 1.1.6
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+
diff --git a/5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/Application.java b/5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/Application.java
new file mode 100644
index 0000000..a66ea9f
--- /dev/null
+++ b/5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/Application.java
@@ -0,0 +1,13 @@
+package com.springboot;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class,args);
+ }
+}
diff --git a/5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/controller/StudentController.java b/5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/controller/StudentController.java
new file mode 100644
index 0000000..ec319b4
--- /dev/null
+++ b/5.Spring-Boot-MyBatis-MultiDataSource/src/main/java/com/springboot/controller/StudentController.java
@@ -0,0 +1,27 @@
+package com.springboot.controller;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.springboot.service.StudentService;
+
+@RestController
+public class StudentController {
+
+ @Autowired
+ private StudentService studentService;
+
+ @RequestMapping("querystudentsfromoracle")
+ public List