Skip to content

Commit 717dfee

Browse files
committed
SpringBoot整合Mybatis并实现多数据源
1 parent c3710e7 commit 717dfee

File tree

51 files changed

+895
-272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+895
-272
lines changed

spring-mybatis-xml/.idea/misc.xml

-7
This file was deleted.

spring-mybatis-xml/.idea/modules.xml

-8
This file was deleted.

spring-mybatis-xml/.idea/spring-mybatis-xml.iml

-9
This file was deleted.

spring-mybatis-xml/.idea/vcs.xml

-6
This file was deleted.

spring-mybatis-xml/.idea/workspace.xml

-239
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
server.port=8333
1+
server.port=8335
22
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/erp?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
3-
spring.datasource.username=xxx
4-
spring.datasource.password=xxx
3+
spring.datasource.username=root
4+
spring.datasource.password=153963
55
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
6+
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package top.snailclimb;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
5+
import org.springframework.boot.autoconfigure.SpringBootApplication;
6+
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
7+
8+
//此注解表示SpringBoot启动类
9+
@SpringBootApplication
10+
// 此注解表示动态扫描DAO接口所在包,实际上不加下面这条语句也可以找到
11+
public class MainApplication {
12+
13+
public static void main(String[] args) {
14+
SpringApplication.run(MainApplication.class, args);
15+
}
16+
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package top.snailclimb.bean;
2+
3+
public class Money {
4+
private int basic;
5+
private int reward;
6+
private int punishment;
7+
8+
public void setBasic(int basic) {
9+
this.basic = basic;
10+
}
11+
12+
public void setReward(int reward) {
13+
this.reward = reward;
14+
}
15+
16+
public void setPunishment(int punishment) {
17+
this.punishment = punishment;
18+
}
19+
20+
public int getBasic() {
21+
return basic;
22+
}
23+
24+
public int getReward() {
25+
return reward;
26+
}
27+
28+
public int getPunishment() {
29+
return punishment;
30+
}
31+
32+
@Override
33+
public String toString() {
34+
return "Money{" +
35+
"basic=" + basic +
36+
", reward=" + reward +
37+
", punishment=" + punishment +
38+
'}';
39+
}
40+
}

0 commit comments

Comments
 (0)