You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
library_manage_system/WebContent/admin/bookborrowlist.jsp

83 lines
4.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@page import="javabean.Util"%> <!-- 导入自定义的Util类 -->
<%@page import="javabean.Base"%> <!-- 导入自定义的Base类 -->
<%@page import="java.sql.ResultSet"%> <!-- 导入ResultSet类用于处理SQL查询结果 -->
<%@page import="java.sql.PreparedStatement"%> <!-- 导入PreparedStatement类用于执行预编译的SQL语句 -->
<%@page import="java.sql.Connection"%> <!-- 导入Connection类用于建立数据库连接 -->
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!-- 设置页面语言为Java内容类型为HTML字符编码为UTF-8 -->
<!DOCTYPE html> <!-- 声明文档类型为HTML5 -->
<html>
<head>
<meta charset="UTF-8"> <!-- 设置HTML文档的字符编码为UTF-8 -->
<title>书籍借阅历史</title> <!-- 设置网页标题 -->
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all"> <!-- 引入Layui样式表 -->
<style>
.layui-table, .layui-table-view{
margin-top: 0px; /* 设置表格顶部边距为0 */
}
</style>
</head>
<body>
<%
String id = request.getParameter("id"); // 获取请求参数中的id
String name = request.getParameter("name"); // 获取请求参数中的name
Connection connection = null; // 初始化数据库连接对象
PreparedStatement pstmt = null; // 初始化预编译SQL语句对象
ResultSet resultSet = null; // 初始化结果集对象
String sql = "select * from borrow_books,borrow_card where book_id=? and card_id=borrow_card.id order by borrow_books.id desc"; // SQL查询语句
connection = (Connection)Base.getConnection(); // 获取数据库连接
pstmt = connection.prepareStatement(sql); // 创建预编译SQL语句对象
pstmt.setString(1,id); // 设置SQL语句中的第一个参数为id
resultSet = pstmt.executeQuery(); // 执行查询并获取结果集
/* while(resultSet.next()){
out.print(resultSet.getString("id")); // 输出结果集中的id字段
}*/
%>
<div class="layui-form"> <!-- Layui表单容器 -->
<table class="layui-table"> <!-- Layui表格 -->
<colgroup>
<col width="150"> <!-- 定义列宽为150px -->
<col width="150"> <!-- 定义列宽为150px -->
<col width="200"> <!-- 定义列宽为200px -->
<col width="200"> <!-- 定义列宽为200px -->
<col width="200"> <!-- 定义列宽为200px -->
<col width="200"> <!-- 定义列宽为200px -->
<col width="220"> <!-- 定义列宽为220px -->
<col width="200"> <!-- 定义列宽为200px -->
<col width="200"> <!-- 定义列宽为200px -->
</colgroup>
<thead>
<tr>
<th>ID</th> <!-- 表头单元格ID -->
<th>书籍ID</th> <!-- 表头单元格书籍ID -->
<th>书籍名</th> <!-- 表头单元格:书籍名 -->
<th>借阅证</th> <!-- 表头单元格:借阅证 -->
<th>借阅者</th> <!-- 表头单元格:借阅者 -->
<th>借阅时间</th> <!-- 表头单元格:借阅时间 -->
<th>归还时间</th> <!-- 表头单元格:归还时间 -->
<th>违规信息</th> <!-- 表头单元格:违规信息 -->
<th>处理人</th> <!-- 表头单元格:处理人 -->
</tr>
<%while(resultSet.next()){ %> <!-- 遍历结果集 -->
<tr>
<td><%=resultSet.getString("id") %></td> <!-- 显示借阅记录的ID -->
<td><%=id %></td> <!-- 显示书籍ID -->
<td><%=name %></td> <!-- 显示书籍名 -->
<td><%=resultSet.getString("borrow_card.id") %></td> <!-- 显示借阅证ID -->
<td><%=resultSet.getString("reader") %></td> <!-- 显示借阅者 -->
<td><%=Util.getFormatDateTime(resultSet.getString("borrow_date")) %></td> <!-- 显示格式化后的借阅日期 -->
<td><%=resultSet.getString("return_date") != null? Util.getFormatDateTime(resultSet.getString("return_date")) : "" %></td> <!-- 显示格式化后的归还日期,如果为空则显示空字符串 -->
<td><%=resultSet.getString("illegal") != null? resultSet.getString("illegal") : "" %></td> <!-- 显示违规信息,如果为空则显示空字符串 -->
<td><%=resultSet.getString("manager_id") != null? resultSet.getString("manager_id") : "" %></td> <!-- 显示处理人ID如果为空则显示空字符串 -->
</tr>
<%} %>
</thead>
<tbody>
<tr>
</tr>
</tbody>
</table>
</div>
</body>
</html>