From ceb06793533d0b78031a0bf8aad59fbd4df42afc Mon Sep 17 00:00:00 2001
From: Yo Vinchen <2982554722@qq.com>
Date: Wed, 15 Mar 2023 08:58:50 +0800
Subject: [PATCH] Initial commit
---
.idea/compiler.xml | 3 +
.idea/dataSources.xml | 12 ++++
.idea/encodings.xml | 1 +
.idea/misc.xml | 1 +
.idea/modules.xml | 1 +
.idea/sqldialects.xml | 6 ++
.../src/main/resources/application.yml | 2 -
.../Springboot05MybatisApplicationTests.java | 1 -
springboot_06_mybatis_plus/.gitignore | 33 +++++++++++
springboot_06_mybatis_plus/pom.xml | 51 +++++++++++++++++
.../Springboot06MybatisPlusApplication.java | 16 ++++++
.../src/main/java/com/yv/dao/BookDao.java | 13 +++++
.../src/main/java/com/yv/domain/Book.java | 55 +++++++++++++++++++
.../src/main/resources/application.yml | 13 +++++
...ringboot06MybatisPlusApplicationTests.java | 23 ++++++++
15 files changed, 228 insertions(+), 3 deletions(-)
create mode 100644 .idea/dataSources.xml
create mode 100644 .idea/sqldialects.xml
create mode 100644 springboot_06_mybatis_plus/.gitignore
create mode 100644 springboot_06_mybatis_plus/pom.xml
create mode 100644 springboot_06_mybatis_plus/src/main/java/com/yv/Springboot06MybatisPlusApplication.java
create mode 100644 springboot_06_mybatis_plus/src/main/java/com/yv/dao/BookDao.java
create mode 100644 springboot_06_mybatis_plus/src/main/java/com/yv/domain/Book.java
create mode 100644 springboot_06_mybatis_plus/src/main/resources/application.yml
create mode 100644 springboot_06_mybatis_plus/src/test/java/com/yv/Springboot06MybatisPlusApplicationTests.java
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index a218f97..5c1f539 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -15,6 +15,7 @@
+
@@ -27,6 +28,7 @@
+
@@ -40,6 +42,7 @@
+
\ No newline at end of file
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
new file mode 100644
index 0000000..4598b4e
--- /dev/null
+++ b/.idea/dataSources.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ mysql.8
+ true
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://localhost:3306/ssm_db
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index d272e11..04ef73b 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -16,5 +16,6 @@
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index c01d42f..3001b2c 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -25,6 +25,7 @@
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
index bec1e1f..b30b4b4 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -10,6 +10,7 @@
+
\ No newline at end of file
diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml
new file mode 100644
index 0000000..56782ca
--- /dev/null
+++ b/.idea/sqldialects.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/springboot_05_mybatis/src/main/resources/application.yml b/springboot_05_mybatis/src/main/resources/application.yml
index 9561a5f..44dc25c 100644
--- a/springboot_05_mybatis/src/main/resources/application.yml
+++ b/springboot_05_mybatis/src/main/resources/application.yml
@@ -1,5 +1,3 @@
-#??????
-
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
diff --git a/springboot_05_mybatis/src/test/java/com/yv/Springboot05MybatisApplicationTests.java b/springboot_05_mybatis/src/test/java/com/yv/Springboot05MybatisApplicationTests.java
index 605de2e..5c51d61 100644
--- a/springboot_05_mybatis/src/test/java/com/yv/Springboot05MybatisApplicationTests.java
+++ b/springboot_05_mybatis/src/test/java/com/yv/Springboot05MybatisApplicationTests.java
@@ -15,5 +15,4 @@ class Springboot05MybatisApplicationTests {
void contextLoads() {
System.out.println(bookDao.getById(1));
}
-
}
diff --git a/springboot_06_mybatis_plus/.gitignore b/springboot_06_mybatis_plus/.gitignore
new file mode 100644
index 0000000..549e00a
--- /dev/null
+++ b/springboot_06_mybatis_plus/.gitignore
@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git a/springboot_06_mybatis_plus/pom.xml b/springboot_06_mybatis_plus/pom.xml
new file mode 100644
index 0000000..fd9badb
--- /dev/null
+++ b/springboot_06_mybatis_plus/pom.xml
@@ -0,0 +1,51 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.0.4
+
+
+ com.yv
+ springboot_06_mybatis_plus
+ 0.0.1-SNAPSHOT
+ springboot_06_mybatis_plus
+ Demo project for Spring Boot
+
+ 17
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.5.3.1
+
+
+ mysql
+ mysql-connector-java
+ 5.1.49
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/springboot_06_mybatis_plus/src/main/java/com/yv/Springboot06MybatisPlusApplication.java b/springboot_06_mybatis_plus/src/main/java/com/yv/Springboot06MybatisPlusApplication.java
new file mode 100644
index 0000000..f6d34c8
--- /dev/null
+++ b/springboot_06_mybatis_plus/src/main/java/com/yv/Springboot06MybatisPlusApplication.java
@@ -0,0 +1,16 @@
+package com.yv;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @author YoVinchen
+ */
+@SpringBootApplication
+public class Springboot06MybatisPlusApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Springboot06MybatisPlusApplication.class, args);
+ }
+
+}
diff --git a/springboot_06_mybatis_plus/src/main/java/com/yv/dao/BookDao.java b/springboot_06_mybatis_plus/src/main/java/com/yv/dao/BookDao.java
new file mode 100644
index 0000000..0e9ebf5
--- /dev/null
+++ b/springboot_06_mybatis_plus/src/main/java/com/yv/dao/BookDao.java
@@ -0,0 +1,13 @@
+package com.yv.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yv.domain.Book;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author YoVinchen
+ * @date 2023/3/14 下午 3:25
+ */
+@Mapper
+public interface BookDao extends BaseMapper {
+}
diff --git a/springboot_06_mybatis_plus/src/main/java/com/yv/domain/Book.java b/springboot_06_mybatis_plus/src/main/java/com/yv/domain/Book.java
new file mode 100644
index 0000000..6a53ad7
--- /dev/null
+++ b/springboot_06_mybatis_plus/src/main/java/com/yv/domain/Book.java
@@ -0,0 +1,55 @@
+package com.yv.domain;
+
+/**
+ * @author YoVinchen
+ * @date 2023/3/14 下午 3:23
+ */
+
+public class Book {
+ private Integer id;
+ private String type;
+ private String name;
+ private String description;
+
+ @Override
+ public String toString() {
+ return "Book{" +
+ "id=" + id +
+ ", type='" + type + '\'' +
+ ", name='" + name + '\'' +
+ ", description='" + description + '\'' +
+ '}';
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/springboot_06_mybatis_plus/src/main/resources/application.yml b/springboot_06_mybatis_plus/src/main/resources/application.yml
new file mode 100644
index 0000000..aa94447
--- /dev/null
+++ b/springboot_06_mybatis_plus/src/main/resources/application.yml
@@ -0,0 +1,13 @@
+# 配置相关配置
+spring:
+ datasource:
+ driver-class-name: com.mysql.jdbc.Driver
+ url: jdbc:mysql://localhost:3306/ssm_db?useSSL=false
+ username: root
+ password: 8520
+
+#配置Mp相关配置
+mybatis-plus:
+ global-config:
+ db-config:
+ table-prefix: tbl_
\ No newline at end of file
diff --git a/springboot_06_mybatis_plus/src/test/java/com/yv/Springboot06MybatisPlusApplicationTests.java b/springboot_06_mybatis_plus/src/test/java/com/yv/Springboot06MybatisPlusApplicationTests.java
new file mode 100644
index 0000000..87d92fb
--- /dev/null
+++ b/springboot_06_mybatis_plus/src/test/java/com/yv/Springboot06MybatisPlusApplicationTests.java
@@ -0,0 +1,23 @@
+package com.yv;
+
+import com.yv.dao.BookDao;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class Springboot06MybatisPlusApplicationTests {
+ @Autowired
+ private BookDao bookDao;
+
+ @Test
+ void contextLoads() {
+ System.out.println(bookDao.selectById(1));
+ }
+
+ @Test
+ void testGetAll(){
+ System.out.println(bookDao.selectList(null));
+ };
+
+}