图书租赁系统-借阅图书

2024-04-24 07:04
文章标签 系统 图书 租赁 借阅

本文主要是介绍图书租赁系统-借阅图书,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在这里插入图片描述
图中展示了所有可以借阅的图书,点击“借阅”按钮便可以借阅图书。
在这里插入图片描述
借阅成功后,可以到bookorder菜单中阅读该书。
在这里插入图片描述
阅读功能待开发。
add.html借阅图书页面

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head><th:block th:include="include :: header('新增bookorder')" /><th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg"><div class="wrapper wrapper-content animated fadeInRight ibox-content"><form class="form-horizontal m" id="form-order-add"><div class="form-group">    <label class="col-sm-3 control-label">book_id:</label><div class="col-sm-8"><input name="bookId" class="form-control" type="text" th:value="${bookId}"></div></div><div class="form-group">    <label class="col-sm-3 control-label">借阅结束时间:</label><div class="col-sm-8"><div class="input-group date"><input name="endTime" class="form-control" placeholder="yyyy-MM-dd HH:mm:ss" type="text"><span class="input-group-addon"><i class="fa fa-calendar"></i></span></div></div></div></form></div><th:block th:include="include :: footer" /><th:block th:include="include :: datetimepicker-js" /><script th:inline="javascript">var prefix = ctx + "system/order"$("#form-order-add").validate({focusCleanup: true});function submitHandler() {if ($.validate.form()) {$.operate.save(prefix + "/add", $('#form-order-add').serialize());}}$("input[name='startTime']").datetimepicker({format: "yyyy-mm-dd",minView: "month",autoclose: true});$("input[name='endTime']").datetimepicker({format: "yyyy-mm-dd hh:ii",autoclose: true});</script>
</body>
</html>

book.html图书列表

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head><th:block th:include="include :: header('book列表')" />
</head>
<body class="gray-bg"><div class="container-div"><div class="row"><div class="col-sm-12 search-collapse"><form id="formId"><div class="select-list"><ul><li><label>书名:</label><input type="text" name="bookName"/></li><li><a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a><a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a></li></ul></div></form></div><div class="btn-group-sm" id="toolbar" role="group"><a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:book:add"><i class="fa fa-plus"></i> 添加</a><a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:book:edit"><i class="fa fa-edit"></i> 修改</a><a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:book:remove"><i class="fa fa-remove"></i> 删除</a><a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:book:export"><i class="fa fa-download"></i> 导出</a></div><div class="col-sm-12 select-table table-striped"><table id="bootstrap-table"></table></div></div></div><th:block th:include="include :: footer" /><script th:inline="javascript">var editFlag = [[${@permission.hasPermi('system:book:edit')}]];var removeFlag = [[${@permission.hasPermi('system:book:remove')}]];var prefix = ctx + "system/book";$(function() {var options = {url: prefix + "/list",createUrl: prefix + "/add",updateUrl: prefix + "/edit/{id}",removeUrl: prefix + "/remove",exportUrl: prefix + "/export",modalName: "book",columns: [{checkbox: true},{field: 'bookId',title: '图书编号',visible: false},{field: 'bookName',title: '书名'},{title: '操作',align: 'center',formatter: function(value, row, index) {var actions = [];actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" οnclick="borrowBook(\'' + row.bookId + '\')"><i class="fa fa-edit"></i>租借</a> ');actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" οnclick="$.operate.remove(\'' + row.bookId + '\')"><i class="fa fa-remove"></i>xxx</a>');return actions.join('');}}]};$.table.init(options);});function borrowBook(bookid){$.modal.open("借阅" , "http://localhost/system/order/add?bookId="+bookid);}</script>
</body>
</html>

book.java图书实体类

package com.ruoyi.system.domain;import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;/*** book对象 book* * @author ruoyi* @date 2024-04-23*/
public class Book extends BaseEntity
{private static final long serialVersionUID = 1L;/** 图书编号 */private Long bookId;/** 书名 */@Excel(name = "书名")private String bookName;public void setBookId(Long bookId) {this.bookId = bookId;}public Long getBookId() {return bookId;}public void setBookName(String bookName) {this.bookName = bookName;}public String getBookName() {return bookName;}@Overridepublic String toString() {return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE).append("bookId", getBookId()).append("bookName", getBookName()).toString();}
}

请求“http://localhost/system/order/add”对应的方法

 /*** 新增bookorder*/@GetMapping("/add")public String add(String bookId, ModelMap mmap){System.out.println("bookId = " + bookId);mmap.put("bookId",bookId);return prefix + "/add";}

BookController.java

package com.ruoyi.web.controller.system;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Book;
import com.ruoyi.system.service.IBookService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;/*** bookController* * @author ruoyi* @date 2024-04-23*/
@Controller
@RequestMapping("/system/book")
public class BookController extends BaseController
{private String prefix = "system/book";@Autowiredprivate IBookService bookService;@RequiresPermissions("system:book:view")@GetMapping()public String book(){return prefix + "/book";}/*** 查询book列表*/@RequiresPermissions("system:book:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(Book book){startPage();List<Book> list = bookService.selectBookList(book);return getDataTable(list);}/*** 导出book列表*/@RequiresPermissions("system:book:export")@Log(title = "book", businessType = BusinessType.EXPORT)@PostMapping("/export")@ResponseBodypublic AjaxResult export(Book book){List<Book> list = bookService.selectBookList(book);ExcelUtil<Book> util = new ExcelUtil<Book>(Book.class);return util.exportExcel(list, "book数据");}/*** 新增book*/@GetMapping("/add")public String add(){return prefix + "/add";}/*** 新增保存book*/@RequiresPermissions("system:book:add")@Log(title = "book", businessType = BusinessType.INSERT)@PostMapping("/add")@ResponseBodypublic AjaxResult addSave(Book book){return toAjax(bookService.insertBook(book));}/*** 修改book*/@RequiresPermissions("system:book:edit")@GetMapping("/edit/{bookId}")public String edit(@PathVariable("bookId") Long bookId, ModelMap mmap){Book book = bookService.selectBookByBookId(bookId);mmap.put("book", book);return prefix + "/edit";}/*** 修改保存book*/@RequiresPermissions("system:book:edit")@Log(title = "book", businessType = BusinessType.UPDATE)@PostMapping("/edit")@ResponseBodypublic AjaxResult editSave(Book book){return toAjax(bookService.updateBook(book));}/*** 删除book*/@RequiresPermissions("system:book:remove")@Log(title = "book", businessType = BusinessType.DELETE)@PostMapping( "/remove")@ResponseBodypublic AjaxResult remove(String ids){return toAjax(bookService.deleteBookByBookIds(ids));}
}

BookMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.BookMapper"><resultMap type="Book" id="BookResult"><result property="bookId"    column="book_id"    /><result property="bookName"    column="book_name"    /></resultMap><sql id="selectBookVo">select book_id, book_name from book</sql><select id="selectBookList" parameterType="Book" resultMap="BookResult"><include refid="selectBookVo"/><where>  <if test="bookName != null  and bookName != ''"> and book_name like concat('%', #{bookName}, '%')</if></where></select><select id="selectBookByBookId" parameterType="Long" resultMap="BookResult"><include refid="selectBookVo"/>where book_id = #{bookId}</select><insert id="insertBook" parameterType="Book" useGeneratedKeys="true" keyProperty="bookId">insert into book<trim prefix="(" suffix=")" suffixOverrides=","><if test="bookName != null">book_name,</if></trim><trim prefix="values (" suffix=")" suffixOverrides=","><if test="bookName != null">#{bookName},</if></trim></insert><update id="updateBook" parameterType="Book">update book<trim prefix="SET" suffixOverrides=","><if test="bookName != null">book_name = #{bookName},</if></trim>where book_id = #{bookId}</update><delete id="deleteBookByBookId" parameterType="Long">delete from book where book_id = #{bookId}</delete><delete id="deleteBookByBookIds" parameterType="String">delete from book where book_id in <foreach item="bookId" collection="array" open="(" separator="," close=")">#{bookId}</foreach></delete></mapper>

编程过程中遇到的问题:

在这里插入图片描述
我想将下面的内容复制到上面去,但是idea会自动把单斜杠变成双斜杠。此时就可以用记事本打开book.html,然后再复制即可。

这篇关于图书租赁系统-借阅图书的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/931064

相关文章

Mac系统下卸载JAVA和JDK的步骤

《Mac系统下卸载JAVA和JDK的步骤》JDK是Java语言的软件开发工具包,它提供了开发和运行Java应用程序所需的工具、库和资源,:本文主要介绍Mac系统下卸载JAVA和JDK的相关资料,需... 目录1. 卸载系统自带的 Java 版本检查当前 Java 版本通过命令卸载系统 Java2. 卸载自定

基于Python实现一个简单的题库与在线考试系统

《基于Python实现一个简单的题库与在线考试系统》在当今信息化教育时代,在线学习与考试系统已成为教育技术领域的重要组成部分,本文就来介绍一下如何使用Python和PyQt5框架开发一个名为白泽题库系... 目录概述功能特点界面展示系统架构设计类结构图Excel题库填写格式模板题库题目填写格式表核心数据结构

Linux系统中的firewall-offline-cmd详解(收藏版)

《Linux系统中的firewall-offline-cmd详解(收藏版)》firewall-offline-cmd是firewalld的一个命令行工具,专门设计用于在没有运行firewalld服务的... 目录主要用途基本语法选项1. 状态管理2. 区域管理3. 服务管理4. 端口管理5. ICMP 阻断

Windows 系统下 Nginx 的配置步骤详解

《Windows系统下Nginx的配置步骤详解》Nginx是一款功能强大的软件,在互联网领域有广泛应用,简单来说,它就像一个聪明的交通指挥员,能让网站运行得更高效、更稳定,:本文主要介绍W... 目录一、为什么要用 Nginx二、Windows 系统下 Nginx 的配置步骤1. 下载 Nginx2. 解压

如何确定哪些软件是Mac系统自带的? Mac系统内置应用查看技巧

《如何确定哪些软件是Mac系统自带的?Mac系统内置应用查看技巧》如何确定哪些软件是Mac系统自带的?mac系统中有很多自带的应用,想要看看哪些是系统自带,该怎么查看呢?下面我们就来看看Mac系统内... 在MAC电脑上,可以使用以下方法来确定哪些软件是系统自带的:1.应用程序文件夹打开应用程序文件夹

windows系统上如何进行maven安装和配置方式

《windows系统上如何进行maven安装和配置方式》:本文主要介绍windows系统上如何进行maven安装和配置方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不... 目录1. Maven 简介2. maven的下载与安装2.1 下载 Maven2.2 Maven安装2.

使用Python实现Windows系统垃圾清理

《使用Python实现Windows系统垃圾清理》Windows自带的磁盘清理工具功能有限,无法深度清理各类垃圾文件,所以本文为大家介绍了如何使用Python+PyQt5开发一个Windows系统垃圾... 目录一、开发背景与工具概述1.1 为什么需要专业清理工具1.2 工具设计理念二、工具核心功能解析2.

Linux系统之stress-ng测压工具的使用

《Linux系统之stress-ng测压工具的使用》:本文主要介绍Linux系统之stress-ng测压工具的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、理论1.stress工具简介与安装2.语法及参数3.具体安装二、实验1.运行8 cpu, 4 fo

ubuntu20.0.4系统中安装Anaconda的超详细图文教程

《ubuntu20.0.4系统中安装Anaconda的超详细图文教程》:本文主要介绍了在Ubuntu系统中如何下载和安装Anaconda,提供了两种方法,详细内容请阅读本文,希望能对你有所帮助... 本文介绍了在Ubuntu系统中如何下载和安装Anaconda。提供了两种方法,包括通过网页手动下载和使用wg

ubuntu系统使用官方操作命令升级Dify指南

《ubuntu系统使用官方操作命令升级Dify指南》Dify支持自动化执行、日志记录和结果管理,适用于数据处理、模型训练和部署等场景,今天我们就来看看ubuntu系统中使用官方操作命令升级Dify的方... Dify 是一个基于 docker 的工作流管理工具,旨在简化机器学习和数据科学领域的多步骤工作流。