Initial commit
This commit is contained in:
parent
c4d06c6674
commit
ceb0679353
@ -15,6 +15,7 @@
|
|||||||
<module name="springboot_01_01_quickstart" />
|
<module name="springboot_01_01_quickstart" />
|
||||||
<module name="demo" />
|
<module name="demo" />
|
||||||
<module name="springboot_02_base_configuration" />
|
<module name="springboot_02_base_configuration" />
|
||||||
|
<module name="springboot_06_mybatis_plus" />
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
<bytecodeTargetLevel>
|
<bytecodeTargetLevel>
|
||||||
@ -27,6 +28,7 @@
|
|||||||
<module name="springboot_03_yaml" target="17" />
|
<module name="springboot_03_yaml" target="17" />
|
||||||
<module name="springboot_04_junit" target="17" />
|
<module name="springboot_04_junit" target="17" />
|
||||||
<module name="springboot_05_mybatis" target="17" />
|
<module name="springboot_05_mybatis" target="17" />
|
||||||
|
<module name="springboot_06_mybatis_plus" target="17" />
|
||||||
</bytecodeTargetLevel>
|
</bytecodeTargetLevel>
|
||||||
</component>
|
</component>
|
||||||
<component name="JavacSettings">
|
<component name="JavacSettings">
|
||||||
@ -40,6 +42,7 @@
|
|||||||
<module name="springboot_03_yaml" options="-parameters" />
|
<module name="springboot_03_yaml" options="-parameters" />
|
||||||
<module name="springboot_04_junit" options="-parameters" />
|
<module name="springboot_04_junit" options="-parameters" />
|
||||||
<module name="springboot_05_mybatis" options="-parameters" />
|
<module name="springboot_05_mybatis" options="-parameters" />
|
||||||
|
<module name="springboot_06_mybatis_plus" options="-parameters" />
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
12
.idea/dataSources.xml
Normal file
12
.idea/dataSources.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="ssm_db@localhost" uuid="ec95c607-c0ba-4bd9-b5cc-e58be64586c2">
|
||||||
|
<driver-ref>mysql.8</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mysql://localhost:3306/ssm_db</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -16,5 +16,6 @@
|
|||||||
<file url="file://$PROJECT_DIR$/springboot_03_yaml/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/springboot_03_yaml/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/springboot_04_junit/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/springboot_04_junit/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/springboot_05_mybatis/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/springboot_05_mybatis/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/springboot_06_mybatis_plus/src/main/java" charset="UTF-8" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -25,6 +25,7 @@
|
|||||||
<option value="$PROJECT_DIR$/springboot_04_junit/pom.xml" />
|
<option value="$PROJECT_DIR$/springboot_04_junit/pom.xml" />
|
||||||
<option value="$PROJECT_DIR$/springboot_05_mybatis/pom.xml" />
|
<option value="$PROJECT_DIR$/springboot_05_mybatis/pom.xml" />
|
||||||
<option value="$PROJECT_DIR$/springboot_03_yaml/pom.xml" />
|
<option value="$PROJECT_DIR$/springboot_03_yaml/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/springboot_06_mybatis_plus/pom.xml" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<module fileurl="file://$PROJECT_DIR$/springboot_03_yaml/springboot_03_yaml.iml" filepath="$PROJECT_DIR$/springboot_03_yaml/springboot_03_yaml.iml" />
|
<module fileurl="file://$PROJECT_DIR$/springboot_03_yaml/springboot_03_yaml.iml" filepath="$PROJECT_DIR$/springboot_03_yaml/springboot_03_yaml.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/springboot_04_junit/springboot_04_junit.iml" filepath="$PROJECT_DIR$/springboot_04_junit/springboot_04_junit.iml" />
|
<module fileurl="file://$PROJECT_DIR$/springboot_04_junit/springboot_04_junit.iml" filepath="$PROJECT_DIR$/springboot_04_junit/springboot_04_junit.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/springboot_05_mybatis/springboot_05_mybatis.iml" filepath="$PROJECT_DIR$/springboot_05_mybatis/springboot_05_mybatis.iml" />
|
<module fileurl="file://$PROJECT_DIR$/springboot_05_mybatis/springboot_05_mybatis.iml" filepath="$PROJECT_DIR$/springboot_05_mybatis/springboot_05_mybatis.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/springboot_06_mybatis_plus/springboot_06_mybatis_plus.iml" filepath="$PROJECT_DIR$/springboot_06_mybatis_plus/springboot_06_mybatis_plus.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
6
.idea/sqldialects.xml
Normal file
6
.idea/sqldialects.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="SqlDialectMappings">
|
||||||
|
<file url="PROJECT" dialect="MySQL" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -1,5 +1,3 @@
|
|||||||
#??????
|
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.jdbc.Driver
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
|
@ -15,5 +15,4 @@ class Springboot05MybatisApplicationTests {
|
|||||||
void contextLoads() {
|
void contextLoads() {
|
||||||
System.out.println(bookDao.getById(1));
|
System.out.println(bookDao.getById(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
33
springboot_06_mybatis_plus/.gitignore
vendored
Normal file
33
springboot_06_mybatis_plus/.gitignore
vendored
Normal file
@ -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/
|
51
springboot_06_mybatis_plus/pom.xml
Normal file
51
springboot_06_mybatis_plus/pom.xml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>3.0.4</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>com.yv</groupId>
|
||||||
|
<artifactId>springboot_06_mybatis_plus</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>springboot_06_mybatis_plus</name>
|
||||||
|
<description>Demo project for Spring Boot</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.5.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>5.1.49</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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<Book> {
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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_
|
@ -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));
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user