图书租赁系统-借阅图书

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

相关文章

在不同系统间迁移Python程序的方法与教程

《在不同系统间迁移Python程序的方法与教程》本文介绍了几种将Windows上编写的Python程序迁移到Linux服务器上的方法,包括使用虚拟环境和依赖冻结、容器化技术(如Docker)、使用An... 目录使用虚拟环境和依赖冻结1. 创建虚拟环境2. 冻结依赖使用容器化技术(如 docker)1. 创

CentOS系统Maven安装教程分享

《CentOS系统Maven安装教程分享》本文介绍了如何在CentOS系统中安装Maven,并提供了一个简单的实际应用案例,安装Maven需要先安装Java和设置环境变量,Maven可以自动管理项目的... 目录准备工作下载并安装Maven常见问题及解决方法实际应用案例总结Maven是一个流行的项目管理工具

C#实现系统信息监控与获取功能

《C#实现系统信息监控与获取功能》在C#开发的众多应用场景中,获取系统信息以及监控用户操作有着广泛的用途,比如在系统性能优化工具中,需要实时读取CPU、GPU资源信息,本文将详细介绍如何使用C#来实现... 目录前言一、C# 监控键盘1. 原理与实现思路2. 代码实现二、读取 CPU、GPU 资源信息1.

在C#中获取端口号与系统信息的高效实践

《在C#中获取端口号与系统信息的高效实践》在现代软件开发中,尤其是系统管理、运维、监控和性能优化等场景中,了解计算机硬件和网络的状态至关重要,C#作为一种广泛应用的编程语言,提供了丰富的API来帮助开... 目录引言1. 获取端口号信息1.1 获取活动的 TCP 和 UDP 连接说明:应用场景:2. 获取硬

JAVA系统中Spring Boot应用程序的配置文件application.yml使用详解

《JAVA系统中SpringBoot应用程序的配置文件application.yml使用详解》:本文主要介绍JAVA系统中SpringBoot应用程序的配置文件application.yml的... 目录文件路径文件内容解释1. Server 配置2. Spring 配置3. Logging 配置4. Ma

2.1/5.1和7.1声道系统有什么区别? 音频声道的专业知识科普

《2.1/5.1和7.1声道系统有什么区别?音频声道的专业知识科普》当设置环绕声系统时,会遇到2.1、5.1、7.1、7.1.2、9.1等数字,当一遍又一遍地看到它们时,可能想知道它们是什... 想要把智能电视自带的音响升级成专业级的家庭影院系统吗?那么你将面临一个重要的选择——使用 2.1、5.1 还是

高效管理你的Linux系统: Debian操作系统常用命令指南

《高效管理你的Linux系统:Debian操作系统常用命令指南》在Debian操作系统中,了解和掌握常用命令对于提高工作效率和系统管理至关重要,本文将详细介绍Debian的常用命令,帮助读者更好地使... Debian是一个流行的linux发行版,它以其稳定性、强大的软件包管理和丰富的社区资源而闻名。在使用

Ubuntu系统怎么安装Warp? 新一代AI 终端神器安装使用方法

《Ubuntu系统怎么安装Warp?新一代AI终端神器安装使用方法》Warp是一款使用Rust开发的现代化AI终端工具,该怎么再Ubuntu系统中安装使用呢?下面我们就来看看详细教程... Warp Terminal 是一款使用 Rust 开发的现代化「AI 终端」工具。最初它只支持 MACOS,但在 20

windows系统下shutdown重启关机命令超详细教程

《windows系统下shutdown重启关机命令超详细教程》shutdown命令是一个强大的工具,允许你通过命令行快速完成关机、重启或注销操作,本文将为你详细解析shutdown命令的使用方法,并提... 目录一、shutdown 命令简介二、shutdown 命令的基本用法三、远程关机与重启四、实际应用

Debian如何查看系统版本? 7种轻松查看Debian版本信息的实用方法

《Debian如何查看系统版本?7种轻松查看Debian版本信息的实用方法》Debian是一个广泛使用的Linux发行版,用户有时需要查看其版本信息以进行系统管理、故障排除或兼容性检查,在Debia... 作为最受欢迎的 linux 发行版之一,Debian 的版本信息在日常使用和系统维护中起着至关重要的作