Initial commit
This commit is contained in:
		
							
								
								
									
										33
									
								
								springboot_07_durid/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								springboot_07_durid/.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/
 | 
			
		||||
							
								
								
									
										54
									
								
								springboot_07_durid/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								springboot_07_durid/pom.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
<?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>2.6.11</version>
 | 
			
		||||
        <relativePath/> <!-- lookup parent from repository -->
 | 
			
		||||
    </parent>
 | 
			
		||||
    <groupId>com.yv</groupId>
 | 
			
		||||
    <artifactId>springboot_07_durid</artifactId>
 | 
			
		||||
    <version>0.0.1-SNAPSHOT</version>
 | 
			
		||||
    <name>springboot_07_durid</name>
 | 
			
		||||
    <description>Demo project for Spring Boot</description>
 | 
			
		||||
    <properties>
 | 
			
		||||
        <java.version>17</java.version>
 | 
			
		||||
    </properties>
 | 
			
		||||
    <dependencies>
 | 
			
		||||
        <!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.mybatis.spring.boot</groupId>
 | 
			
		||||
            <artifactId>mybatis-spring-boot-starter</artifactId>
 | 
			
		||||
            <version>2.3.0</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.alibaba</groupId>
 | 
			
		||||
            <artifactId>druid-spring-boot-starter</artifactId>
 | 
			
		||||
            <version>1.2.16</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,13 @@
 | 
			
		||||
package com.yv;
 | 
			
		||||
 | 
			
		||||
import org.springframework.boot.SpringApplication;
 | 
			
		||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
 | 
			
		||||
 | 
			
		||||
@SpringBootApplication
 | 
			
		||||
public class Springboot07DuridApplication {
 | 
			
		||||
 | 
			
		||||
	public static void main(String[] args) {
 | 
			
		||||
		SpringApplication.run(Springboot07DuridApplication.class, args);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										19
									
								
								springboot_07_durid/src/main/java/com/yv/dao/BookDao.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								springboot_07_durid/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_07_durid/src/main/java/com/yv/domain/Book.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								springboot_07_durid/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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								springboot_07_durid/src/main/resources/application.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								springboot_07_durid/src/main/resources/application.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
# 配置相关配置
 | 
			
		||||
#spring:
 | 
			
		||||
#  datasource:
 | 
			
		||||
#    driver-class-name: com.mysql.jdbc.Driver
 | 
			
		||||
#    url: jdbc:mysql://localhost:3306/ssm_db?useSSL=false
 | 
			
		||||
#    username: root
 | 
			
		||||
#    password: 8520
 | 
			
		||||
#    type: com.alibaba.druid.pool.DruidDataSource
 | 
			
		||||
 | 
			
		||||
spring:
 | 
			
		||||
  datasource:
 | 
			
		||||
    druid:
 | 
			
		||||
      driver-class-name: com.mysql.jdbc.Driver
 | 
			
		||||
      url: jdbc:mysql://localhost:3306/ssm_db?useSSL=false
 | 
			
		||||
      username: root
 | 
			
		||||
      password: 8520
 | 
			
		||||
@@ -0,0 +1,18 @@
 | 
			
		||||
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 Springboot07DuridApplicationTests {
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private BookDao bookDao;
 | 
			
		||||
	@Test
 | 
			
		||||
	void contextLoads() {
 | 
			
		||||
		System.out.println(bookDao.getById(1));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user