基础版本完成

This commit is contained in:
2023-08-14 22:45:38 +08:00
commit 6c3b4925cf
28 changed files with 689 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package com.test;
import com.apple.eawt.Application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* ClassName: BookApplication
* Package: com.test
*
* @author yovinchen
* @Create 2023/8/14 16:23
*/
@SpringBootApplication
public class BookApplication {
public static void main(String[] args) {
SpringApplication.run(BookApplication.class,args);
}
}

View File

@@ -0,0 +1,28 @@
package com.test.controller;
import com.test.service.BookService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.awt.print.Book;
/**
* ClassName: BookController
* Package: com.test.controller
*
* @author yovinchen
* @Create 2023/8/14 17:11
*/
@RestController
public class BookController {
@Resource
BookService service;
@RequestMapping("/book/{bid}")
Book findBookById(@PathVariable("bid") int bid){
return service.getBookById(bid);
}
}

View File

@@ -0,0 +1,20 @@
package com.test.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.awt.print.Book;
/**
* ClassName: BookMapper
* Package: com.test.mapper
*
* @author yovinchen
* @Create 2023/8/14 17:02
*/
@Mapper
public interface BookMapper {
@Select("select * from DB_BOOK where bid = #{bid}")
Book getBookById(int bid);
}

View File

@@ -0,0 +1,14 @@
package com.test.service;
import java.awt.print.Book;
/**
* ClassName: BookService
* Package: com.test.service
*
* @author yovinchen
* @Create 2023/8/14 17:03
*/
public interface BookService {
Book getBookById(int bid);
}

View File

@@ -0,0 +1,27 @@
package com.test.service.impl;
import com.test.mapper.BookMapper;
import com.test.service.BookService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.awt.print.Book;
/**
* ClassName: BookServiceImpl
* Package: com.test.service.impl
*
* @author yovinchen
* @Create 2023/8/14 17:09
*/
@Service
public class BookServiceImpl implements BookService {
@Resource
BookMapper mapper;
@Override
public Book getBookById(int bid) {
return mapper.getBookById(bid);
}
}

View File

@@ -0,0 +1,8 @@
server:
port: 8201
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://43.143.164.194:3306/mac
username: mac
password: mactest