修正
This commit is contained in:
		
							
								
								
									
										3
									
								
								.idea/compiler.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								.idea/compiler.xml
									
									
									
										generated
									
									
									
								
							@@ -11,6 +11,7 @@
 | 
			
		||||
        <module name="springboot_01_04_quickstart" />
 | 
			
		||||
        <module name="springboot_04_junit" />
 | 
			
		||||
        <module name="springboot_03_yaml" />
 | 
			
		||||
        <module name="springboot_05_mybatis" />
 | 
			
		||||
        <module name="springboot_01_01_quickstart" />
 | 
			
		||||
        <module name="demo" />
 | 
			
		||||
        <module name="springboot_02_base_configuration" />
 | 
			
		||||
@@ -25,6 +26,7 @@
 | 
			
		||||
      <module name="springboot_02_base_configuration" target="17" />
 | 
			
		||||
      <module name="springboot_03_yaml" target="17" />
 | 
			
		||||
      <module name="springboot_04_junit" target="17" />
 | 
			
		||||
      <module name="springboot_05_mybatis" target="17" />
 | 
			
		||||
    </bytecodeTargetLevel>
 | 
			
		||||
  </component>
 | 
			
		||||
  <component name="JavacSettings">
 | 
			
		||||
@@ -37,6 +39,7 @@
 | 
			
		||||
      <module name="springboot_02_base_configuration" options="-parameters" />
 | 
			
		||||
      <module name="springboot_03_yaml" options="-parameters" />
 | 
			
		||||
      <module name="springboot_04_junit" options="-parameters" />
 | 
			
		||||
      <module name="springboot_05_mybatis" options="-parameters" />
 | 
			
		||||
    </option>
 | 
			
		||||
  </component>
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										1
									
								
								.idea/encodings.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								.idea/encodings.xml
									
									
									
										generated
									
									
									
								
							@@ -15,5 +15,6 @@
 | 
			
		||||
    <file url="file://$PROJECT_DIR$/springboot_03_yaml/src/main/java" 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_05_mybatis/src/main/java" charset="UTF-8" />
 | 
			
		||||
  </component>
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										13
									
								
								.idea/libraries/Maven__com_zaxxer_HikariCP_5_0_1.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.idea/libraries/Maven__com_zaxxer_HikariCP_5_0_1.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<component name="libraryTable">
 | 
			
		||||
  <library name="Maven: com.zaxxer:HikariCP:5.0.1">
 | 
			
		||||
    <CLASSES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/com/zaxxer/HikariCP/5.0.1/HikariCP-5.0.1.jar!/" />
 | 
			
		||||
    </CLASSES>
 | 
			
		||||
    <JAVADOC>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/com/zaxxer/HikariCP/5.0.1/HikariCP-5.0.1-javadoc.jar!/" />
 | 
			
		||||
    </JAVADOC>
 | 
			
		||||
    <SOURCES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/com/zaxxer/HikariCP/5.0.1/HikariCP-5.0.1-sources.jar!/" />
 | 
			
		||||
    </SOURCES>
 | 
			
		||||
  </library>
 | 
			
		||||
</component>
 | 
			
		||||
							
								
								
									
										13
									
								
								.idea/libraries/Maven__org_mybatis_mybatis_3_5_11.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.idea/libraries/Maven__org_mybatis_mybatis_3_5_11.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<component name="libraryTable">
 | 
			
		||||
  <library name="Maven: org.mybatis:mybatis:3.5.11">
 | 
			
		||||
    <CLASSES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/mybatis/3.5.11/mybatis-3.5.11.jar!/" />
 | 
			
		||||
    </CLASSES>
 | 
			
		||||
    <JAVADOC>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/mybatis/3.5.11/mybatis-3.5.11-javadoc.jar!/" />
 | 
			
		||||
    </JAVADOC>
 | 
			
		||||
    <SOURCES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/mybatis/3.5.11/mybatis-3.5.11-sources.jar!/" />
 | 
			
		||||
    </SOURCES>
 | 
			
		||||
  </library>
 | 
			
		||||
</component>
 | 
			
		||||
							
								
								
									
										13
									
								
								.idea/libraries/Maven__org_mybatis_mybatis_spring_3_0_0.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.idea/libraries/Maven__org_mybatis_mybatis_spring_3_0_0.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<component name="libraryTable">
 | 
			
		||||
  <library name="Maven: org.mybatis:mybatis-spring:3.0.0">
 | 
			
		||||
    <CLASSES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/mybatis-spring/3.0.0/mybatis-spring-3.0.0.jar!/" />
 | 
			
		||||
    </CLASSES>
 | 
			
		||||
    <JAVADOC>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/mybatis-spring/3.0.0/mybatis-spring-3.0.0-javadoc.jar!/" />
 | 
			
		||||
    </JAVADOC>
 | 
			
		||||
    <SOURCES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/mybatis-spring/3.0.0/mybatis-spring-3.0.0-sources.jar!/" />
 | 
			
		||||
    </SOURCES>
 | 
			
		||||
  </library>
 | 
			
		||||
</component>
 | 
			
		||||
							
								
								
									
										13
									
								
								.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_3_0_0.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_3_0_0.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<component name="libraryTable">
 | 
			
		||||
  <library name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:3.0.0">
 | 
			
		||||
    <CLASSES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/3.0.0/mybatis-spring-boot-autoconfigure-3.0.0.jar!/" />
 | 
			
		||||
    </CLASSES>
 | 
			
		||||
    <JAVADOC>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/3.0.0/mybatis-spring-boot-autoconfigure-3.0.0-javadoc.jar!/" />
 | 
			
		||||
    </JAVADOC>
 | 
			
		||||
    <SOURCES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/3.0.0/mybatis-spring-boot-autoconfigure-3.0.0-sources.jar!/" />
 | 
			
		||||
    </SOURCES>
 | 
			
		||||
  </library>
 | 
			
		||||
</component>
 | 
			
		||||
							
								
								
									
										13
									
								
								.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_3_0_0.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_3_0_0.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<component name="libraryTable">
 | 
			
		||||
  <library name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.0">
 | 
			
		||||
    <CLASSES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/spring/boot/mybatis-spring-boot-starter/3.0.0/mybatis-spring-boot-starter-3.0.0.jar!/" />
 | 
			
		||||
    </CLASSES>
 | 
			
		||||
    <JAVADOC>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/spring/boot/mybatis-spring-boot-starter/3.0.0/mybatis-spring-boot-starter-3.0.0-javadoc.jar!/" />
 | 
			
		||||
    </JAVADOC>
 | 
			
		||||
    <SOURCES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/mybatis/spring/boot/mybatis-spring-boot-starter/3.0.0/mybatis-spring-boot-starter-3.0.0-sources.jar!/" />
 | 
			
		||||
    </SOURCES>
 | 
			
		||||
  </library>
 | 
			
		||||
</component>
 | 
			
		||||
							
								
								
									
										13
									
								
								.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_3_0_4.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_3_0_4.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<component name="libraryTable">
 | 
			
		||||
  <library name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.4">
 | 
			
		||||
    <CLASSES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/springframework/boot/spring-boot-starter-jdbc/3.0.4/spring-boot-starter-jdbc-3.0.4.jar!/" />
 | 
			
		||||
    </CLASSES>
 | 
			
		||||
    <JAVADOC>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/springframework/boot/spring-boot-starter-jdbc/3.0.4/spring-boot-starter-jdbc-3.0.4-javadoc.jar!/" />
 | 
			
		||||
    </JAVADOC>
 | 
			
		||||
    <SOURCES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/springframework/boot/spring-boot-starter-jdbc/3.0.4/spring-boot-starter-jdbc-3.0.4-sources.jar!/" />
 | 
			
		||||
    </SOURCES>
 | 
			
		||||
  </library>
 | 
			
		||||
</component>
 | 
			
		||||
							
								
								
									
										13
									
								
								.idea/libraries/Maven__org_springframework_spring_jdbc_6_0_6.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.idea/libraries/Maven__org_springframework_spring_jdbc_6_0_6.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<component name="libraryTable">
 | 
			
		||||
  <library name="Maven: org.springframework:spring-jdbc:6.0.6">
 | 
			
		||||
    <CLASSES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/springframework/spring-jdbc/6.0.6/spring-jdbc-6.0.6.jar!/" />
 | 
			
		||||
    </CLASSES>
 | 
			
		||||
    <JAVADOC>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/springframework/spring-jdbc/6.0.6/spring-jdbc-6.0.6-javadoc.jar!/" />
 | 
			
		||||
    </JAVADOC>
 | 
			
		||||
    <SOURCES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/springframework/spring-jdbc/6.0.6/spring-jdbc-6.0.6-sources.jar!/" />
 | 
			
		||||
    </SOURCES>
 | 
			
		||||
  </library>
 | 
			
		||||
</component>
 | 
			
		||||
							
								
								
									
										13
									
								
								.idea/libraries/Maven__org_springframework_spring_tx_6_0_6.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.idea/libraries/Maven__org_springframework_spring_tx_6_0_6.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<component name="libraryTable">
 | 
			
		||||
  <library name="Maven: org.springframework:spring-tx:6.0.6">
 | 
			
		||||
    <CLASSES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/springframework/spring-tx/6.0.6/spring-tx-6.0.6.jar!/" />
 | 
			
		||||
    </CLASSES>
 | 
			
		||||
    <JAVADOC>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/springframework/spring-tx/6.0.6/spring-tx-6.0.6-javadoc.jar!/" />
 | 
			
		||||
    </JAVADOC>
 | 
			
		||||
    <SOURCES>
 | 
			
		||||
      <root url="jar://E:/maven-cangku/org/springframework/spring-tx/6.0.6/spring-tx-6.0.6-sources.jar!/" />
 | 
			
		||||
    </SOURCES>
 | 
			
		||||
  </library>
 | 
			
		||||
</component>
 | 
			
		||||
							
								
								
									
										1
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							@@ -24,6 +24,7 @@
 | 
			
		||||
        <option value="$PROJECT_DIR$/springboot_01_01_quickstart/pom.xml" />
 | 
			
		||||
        <option value="$PROJECT_DIR$/springboot_03_yaml/pom.xml" />
 | 
			
		||||
        <option value="$PROJECT_DIR$/springboot_04_junit/pom.xml" />
 | 
			
		||||
        <option value="$PROJECT_DIR$/springboot_05_mybatis/pom.xml" />
 | 
			
		||||
      </list>
 | 
			
		||||
    </option>
 | 
			
		||||
  </component>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								.idea/modules.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								.idea/modules.xml
									
									
									
										generated
									
									
									
								
							@@ -10,6 +10,7 @@
 | 
			
		||||
      <module fileurl="file://$PROJECT_DIR$/springboot_02_base_configuration/springboot_02_base_configuration.iml" filepath="$PROJECT_DIR$/springboot_02_base_configuration/springboot_02_base_configuration.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_05_mybatis/springboot_05_mybatis.iml" filepath="$PROJECT_DIR$/springboot_05_mybatis/springboot_05_mybatis.iml" />
 | 
			
		||||
    </modules>
 | 
			
		||||
  </component>
 | 
			
		||||
</project>
 | 
			
		||||
@@ -5,6 +5,10 @@ import org.junit.jupiter.api.Test;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.boot.test.context.SpringBootTest;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @RunWith(设置运行器)
 | 
			
		||||
 * @ContextConfiguration(classes)
 | 
			
		||||
 */
 | 
			
		||||
@SpringBootTest
 | 
			
		||||
class Springboot04JunitApplicationTests {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										33
									
								
								springboot_05_mybatis/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								springboot_05_mybatis/.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/
 | 
			
		||||
							
								
								
									
										47
									
								
								springboot_05_mybatis/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								springboot_05_mybatis/pom.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
<?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_05_mybatis</artifactId>
 | 
			
		||||
	<version>0.0.1-SNAPSHOT</version>
 | 
			
		||||
	<name>springboot_05_mybatis</name>
 | 
			
		||||
	<description>Demo project for Spring Boot</description>
 | 
			
		||||
	<properties>
 | 
			
		||||
		<java.version>17</java.version>
 | 
			
		||||
	</properties>
 | 
			
		||||
	<dependencies>
 | 
			
		||||
		<dependency>
 | 
			
		||||
			<groupId>org.mybatis.spring.boot</groupId>
 | 
			
		||||
			<artifactId>mybatis-spring-boot-starter</artifactId>
 | 
			
		||||
			<version>3.0.0</version>
 | 
			
		||||
		</dependency>
 | 
			
		||||
		<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
 | 
			
		||||
		<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 Springboot05MybatisApplication {
 | 
			
		||||
 | 
			
		||||
	public static void main(String[] args) {
 | 
			
		||||
		SpringApplication.run(Springboot05MybatisApplication.class, args);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										19
									
								
								springboot_05_mybatis/src/main/java/com/yv/dao/BookDao.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								springboot_05_mybatis/src/main/java/com/yv/dao/BookDao.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
package com.yv.dao;
 | 
			
		||||
 | 
			
		||||
import com.yv.domain.Book;
 | 
			
		||||
import org.apache.ibatis.annotations.Mapper;
 | 
			
		||||
import org.apache.ibatis.annotations.Select;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author YoVinchen
 | 
			
		||||
 * @date 2023/3/9 下午 3:25
 | 
			
		||||
 */
 | 
			
		||||
@Mapper
 | 
			
		||||
public interface BookDao {
 | 
			
		||||
    /**
 | 
			
		||||
     * @param id
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @Select("select * from tbl_book where id = #{id}")
 | 
			
		||||
    public Book getById(Integer id);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										55
									
								
								springboot_05_mybatis/src/main/java/com/yv/domain/Book.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								springboot_05_mybatis/src/main/java/com/yv/domain/Book.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,55 @@
 | 
			
		||||
package com.yv.domain;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author YoVinchen
 | 
			
		||||
 * @date 2023/3/9 下午 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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										8
									
								
								springboot_05_mybatis/src/main/resources/application.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								springboot_05_mybatis/src/main/resources/application.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
#??????
 | 
			
		||||
 | 
			
		||||
spring:
 | 
			
		||||
  datasource:
 | 
			
		||||
    driver-class-name: com.mysql.jdbc.Driver
 | 
			
		||||
    url: jdbc:mysql://localhost:3306/ssm_db?useSSL=false
 | 
			
		||||
    username: root
 | 
			
		||||
    password: 8520
 | 
			
		||||
@@ -0,0 +1,19 @@
 | 
			
		||||
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 Springboot05MybatisApplicationTests {
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private BookDao bookDao;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    void contextLoads() {
 | 
			
		||||
        System.out.println(bookDao.getById(1));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user