教材管理系统
开发工具:idea
数据库:MYSQL
数据库连接工具: navcat
模式:前后端分离
后端开发技术:SpringBoot springMVC Mybatis
前端开发技术: LayUI Html
前端运行环境:idea 或 hbuildx 或VScode可以单独运行。
项目具体功能请看视频:
【java毕业设计】基于springboot+mybatis+layui的前后端分离高校教材管理系统
计算机技术和网络信息技术的发展和普及,据调查,到目前为止,我国还有许多高校,甚至一些重点院校的教材管理工 作仍为手工管理方式,这种管理方式不但与现实高校教材管理业务的需求不相适 应,而且也与高校信息化建设的发展趋势不相适应。因此,高校教材管理人员目 前迫切需要一套方便、高效的计算机化的管理信息系统来代替他们繁重、低效的传统手工管理方式,并最终实现教材管理的全面自动化。
pom.xml:
<?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.2.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.gydx</groupId>
<artifactId>book</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>bookManager</name>
<description>Demo project for Spring Boot qq2118119173</description>
<properties>
<shiro.version>1.3.1</shiro.version>
<java.version>8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.6</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>4.1.5</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.62</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.20</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-all</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session</artifactId>
<version>1.3.5.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.gydx.bookManager.controller;
import com.alibaba.fastjson.JSONObject;
import com.gydx.bookManager.pojo.BookPageInfoPojo;
import com.gydx.bookManager.entity.Book;
import com.gydx.bookManager.pojo.ReceiveData;
import com.gydx.bookManager.service.BookService;
import com.gydx.bookManager.util.ImageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@CrossOrigin
@RestController
public class BookInfoController {
@Autowired
private BookService bookService;
@RequestMapping("/getBookList")
public String getBookList(Integer page, Integer limit, String name, String author, String publisher) {
BookPageInfoPojo bookPageInfoPojo = new BookPageInfoPojo();
bookPageInfoPojo.setPage(page);
bookPageInfoPojo.setLimit(limit);
bookPageInfoPojo.setAuthor(author);
bookPageInfoPojo.setName(name);
bookPageInfoPojo.setPublisher(publisher);
JSONObject jsonObject = new JSONObject();
List<Book> books1, books2;
if (bookPageInfoPojo.getName().equals("") && bookPageInfoPojo.getAuthor().equals("") && bookPageInfoPojo.getPublisher().equals("")) {
books1 = bookService.getBookList(bookPageInfoPojo.getPage(), bookPageInfoPojo.getLimit());
books2 = bookService.getAllBooks();
} else {
books1 = bookService.getBookListByCondition(bookPageInfoPojo);
books2 = bookService.getAllBooksByCondition(bookPageInfoPojo);
}
jsonObject.put("code", 0);
jsonObject.put("msg", "查询成功");
jsonObject.put("count", books2.size());
jsonObject.put("data", books1);
return jsonObject.toJSONString();
}
@RequestMapping("/deleteOneBookById")
public String deleteOneBookById(@RequestBody Book book) {
JSONObject jsonObject = new JSONObject();
bookService.deleteOneBookById(book.getId());
jsonObject.put("msg", "删除成功!");
return jsonObject.toJSONString();
}
@RequestMapping("/updateBookInfo")
public String updateBookInfo(@RequestBody Book book) {
JSONObject jsonObject = new JSONObject();
bookService.updateBookInfo(book);
jsonObject.put("msg", "更新成功!");
return jsonObject.toJSONString();
}
@RequestMapping("/deleteBooks")
public String deleteBooks(@RequestBody List<Book> books) {
JSONObject jsonObject = new JSONObject();
bookService.deleteBooks(books);
jsonObject.put("msg", "已删除!");
return jsonObject.toJSONString();
}
@RequestMapping("/addBook")
public String addBook(@RequestBody Book book) {
JSONObject jsonObject = new JSONObject();
int i = bookService.addBook(book);
if (i == 0) {
jsonObject.put("msg", "该教材已存在!");
return jsonObject.toJSONString();
}
jsonObject.put("msg", "添加成功");
return jsonObject.toJSONString();
}
@RequestMapping("/getBookListByMajor")
public String getBookListByMajor(@RequestBody ReceiveData receiveData) {
JSONObject jsonObject = new JSONObject();
List<Book> books = bookService.getBookListByMajor(receiveData.getMajorName());
jsonObject.put("msg", "查询成功");
jsonObject.put("data", books);
return jsonObject.toJSONString();
}
@RequestMapping("/getAllBookList")
public String getAllBookList() {
JSONObject jsonObject = new JSONObject();
List<Book> books = bookService.getAllBookList();
jsonObject.put("msg", "查询成功");
jsonObject.put("data", books);
return jsonObject.toJSONString();
}
@RequestMapping("/getAllDBookName")
public String getAllDBookName() {
JSONObject jsonObject = new JSONObject();
List<Book> books = bookService.getAllDBookName();
jsonObject.put("msg", "查询成功");
jsonObject.put("data", books);
return jsonObject.toJSONString();
}
@RequestMapping("/getAllDBookAuthor")
public String getAllDBookAuthor() {
JSONObject jsonObject = new JSONObject();
List<Book> books = bookService.getAllDBookAuthor();
jsonObject.put("msg", "查询成功");
jsonObject.put("data", books);
return jsonObject.toJSONString();
}
@RequestMapping("/getAllDBookAuthorByBookName")
public String getAllDBookAuthorByBookName(@RequestBody ReceiveData receiveData) {
JSONObject jsonObject = new JSONObject();
List<Book> books = bookService.getAllDBookAuthorByBookName(receiveData.getBookName());
jsonObject.put("msg", "查询成功");
jsonObject.put("data", books);
return jsonObject.toJSONString();
}
@RequestMapping("/getAllDBookPublishTimeByBookAuthor")
public String getAllDBookPublishTimeByBookAuthor(@RequestBody ReceiveData receiveData) {
JSONObject jsonObject = new JSONObject();
List<Book> books = bookService.getAllDBookPublishTimeByBookAuthor(receiveData.getBookName(), receiveData.getAuthor());
jsonObject.put("msg", "查询成功");
jsonObject.put("data", books);
return jsonObject.toJSONString();
}
@RequestMapping("/getAllDBookPublisherByBookPublishTime")
public String getAllDBookPublisherByBookPublishTime(@RequestBody ReceiveData receiveData) {
JSONObject jsonObject = new JSONObject();
List<Book> books = bookService.getAllDBookPublisherByBookPublishTime(receiveData.getBookName(), receiveData.getAuthor(), receiveData.getPublishTime());
jsonObject.put("msg", "查询成功");
jsonObject.put("data", books);
return jsonObject.toJSONString();
}
@RequestMapping("/getAllDBookPriceByBookPublisher")
public String getAllDBookPriceByBookPublisher(@RequestBody ReceiveData receiveData) {
JSONObject jsonObject = new JSONObject();
List<Book> books = bookService.getAllDBookPriceByBookPublisher(receiveData.getBookName(), receiveData.getAuthor(), receiveData.getPublishTime(), receiveData.getPublisher());
jsonObject.put("msg", "查询成功");
jsonObject.put("data", books);
return jsonObject.toJSONString();
}
}
application.yml:
server:
port: 8080
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/book_manager?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
username: root
password: root
# 连接池配置
druid:
# 初始化,最小,最大 连接数
initial-size: 3
min-idle: 3
max-active: 18
# 获取数据库连接最长等待时间
max-wait: 60000
# 多久检测一次需要关闭的空闲连接
time-between-eviction-runs-millis: 60000
validation-query: SELECT 'x'
redis:
host: localhost
port: 6379
jedis:
pool:
max-active: 10
max-idle: 8
min-idle: 0
max-wait: -1
timeout: 0
mail:
host: smtp.qq.com
password: ojxxnhpnawswffae
username: 1102348527@qq.com
properties:
mail:
auth: true
smtp:
enable: true
mvc:
static-path-pattern: classpath:static/**
resources:
static-locations: classpath:static/
mybatis:
mapper-locations: classpath:mapper/*Mapper.xml
configuration:
map-underscore-to-camel-case: true
logging:
level:
root: info
file:
path: /bookManager/
max-history: 30
name: mylog.log
pattern:
file: '%d{yyyy-MM-dd} [%thread] %-5level %logger{50} - %msg%n'