From d635a45a083c61b9ee860040a4cf2c7f459f5692 Mon Sep 17 00:00:00 2001 From: you <284908631@qq.com> Date: Sun, 7 Jun 2020 15:22:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90=E5=80=9F?= =?UTF-8?q?=E9=98=85=E4=BF=A1=E6=81=AF=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebContent/admin/booklist.jsp | 5 +- WebContent/admin/borrowlist.jsp | 127 ++++++++++++++++++++++++++++++ WebContent/admin/cardborrow.jsp | 68 ++++++++++++++++ WebContent/admin/cardlist.jsp | 16 +++- WebContent/admin/index.jsp | 1 + src/servlet/admin/BorrowList.java | 115 +++++++++++++++++++++++++++ src/servlet/admin/CardList.java | 1 - 7 files changed, 329 insertions(+), 4 deletions(-) create mode 100644 WebContent/admin/borrowlist.jsp create mode 100644 WebContent/admin/cardborrow.jsp create mode 100644 src/servlet/admin/BorrowList.java diff --git a/WebContent/admin/booklist.jsp b/WebContent/admin/booklist.jsp index 74eb618..f2cfffb 100644 --- a/WebContent/admin/booklist.jsp +++ b/WebContent/admin/booklist.jsp @@ -81,6 +81,7 @@ @@ -129,9 +130,9 @@ }} ,{field: 'position', title: '位置', width: 110, sort: true} ,{field: 'status', title: '状态', width: 60, templet:'#statusTpl'} - ,{field: 'description', title: '描述', width: 380} + ,{field: 'description', title: '描述', width: 340} //,{field: 'operate', title: '操作', width: 200, templet: 'titleTpl'} - ,{fixed: 'right', title:'操作', width:150, align:'center', toolbar: '#barDemo'} //这里的toolbar值是模板元素的选择器 + ,{fixed: 'right', title:'操作', width: 200, align:'center', toolbar: '#barDemo'} //这里的toolbar值是模板元素的选择器 ]] ,id: 'idTest' }); diff --git a/WebContent/admin/borrowlist.jsp b/WebContent/admin/borrowlist.jsp new file mode 100644 index 0000000..0390704 --- /dev/null +++ b/WebContent/admin/borrowlist.jsp @@ -0,0 +1,127 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + + 借阅记录 + + + + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/WebContent/admin/cardborrow.jsp b/WebContent/admin/cardborrow.jsp new file mode 100644 index 0000000..e959efc --- /dev/null +++ b/WebContent/admin/cardborrow.jsp @@ -0,0 +1,68 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +借阅证借阅记录 + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
人物民族出场时间格言
贤心汉族1989-10-14人生似修行
张爱玲汉族1920-09-30于千万人之中遇见你所遇见的人,于千万年之中,时间的无涯的荒野里…
Helen Keller拉丁美裔1880-06-27 Life is either a daring adventure or nothing.
岳飞汉族1103-北宋崇宁二年教科书再滥改,也抹不去“民族英雄”的事实
孟子华夏族(汉族)公元前-372年猿强,则国强。国强,则猿更强!
+
+ + \ No newline at end of file diff --git a/WebContent/admin/cardlist.jsp b/WebContent/admin/cardlist.jsp index 19b26db..2d17ed2 100644 --- a/WebContent/admin/cardlist.jsp +++ b/WebContent/admin/cardlist.jsp @@ -38,6 +38,7 @@ @@ -65,7 +66,7 @@ ,{field:'reader', width:180, title: '用户名', sort: true} ,{field:'rule_id', width:180, title: '借阅规则', sort: true} ,{field:'status', width:180, title: '状态', templet: '#statusTpl'} - ,{fixed: 'right', title:'操作', toolbar: '#operateBar', align: 'center', width:150} + ,{fixed: 'right', title:'操作', toolbar: '#operateBar', align: 'center', width:250} ]] ,page: true }); @@ -160,6 +161,19 @@ }) }) + break; + case 'cardBorrow': + layer.open({ + type: 2, + title: '借阅历史', + area: ['800px', '600px'], + maxmin: true, + shadeClose: true, + content: 'cardborrow.jsp?id=' +id, + end: function(){ + //$(".layui-laypage-btn").click(); + } + }) } }) }); diff --git a/WebContent/admin/index.jsp b/WebContent/admin/index.jsp index c7ade7a..d18f6b2 100644 --- a/WebContent/admin/index.jsp +++ b/WebContent/admin/index.jsp @@ -52,6 +52,7 @@
  • 借阅证管理
  • +
  • 借阅信息查询
  • 借阅规则管理
  • 图书管理员管理
  • 系统管理
  • diff --git a/src/servlet/admin/BorrowList.java b/src/servlet/admin/BorrowList.java new file mode 100644 index 0000000..db37f94 --- /dev/null +++ b/src/servlet/admin/BorrowList.java @@ -0,0 +1,115 @@ +package servlet.admin; + +import java.io.IOException; +import java.io.PrintWriter; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.mysql.jdbc.Connection; + +import javabean.Base; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + + +@WebServlet("/admin/borrowList") +public class BorrowList extends HttpServlet { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + resp.setContentType("application/json; charset=utf8"); + // 接收参数 + String limit = req.getParameter("limit"); + String page = req.getParameter("page"); + String condition = (String) req.getParameter("condition"); + String conditionValue = (String) req.getParameter("conditionValue"); + String where = ""; // 无限制条件 + if(page == null) { + page = "1"; + } + if(limit == null) { + limit = "10"; + } + // 准备查询 + Connection connection = null; + PreparedStatement pstmt = null; + PreparedStatement countPstmt = null; + ResultSet resultSet = null; + ResultSet countSet = null; + String sql = ""; + String countSql = ""; + // 准备返回参数 + int code = 1; + String msg = "error"; + int count = 0; + + JSONObject jsonData = new JSONObject(); + JSONArray jsonArray = new JSONArray(); + JSONObject jsonResult = new JSONObject(); + // 进行查询 + try { + connection = (Connection) Base.getConnection(); + sql = "select * from borrow_books "; + if(condition!=null && conditionValue != null && !condition.equals("") && !conditionValue.equals("")) { + where = " where "+ condition +" like '%" +conditionValue +"%' "; + sql += where; + } + sql += " limit ?,?";//1 10 (1-1)*10 + pstmt = connection.prepareStatement(sql); + pstmt.setInt(1, (Integer.parseInt(page)-1) * Integer.parseInt(limit)); + pstmt.setInt(2, Integer.parseInt(limit)); + resultSet = pstmt.executeQuery(); + while(resultSet.next()) { + jsonData.put("id", resultSet.getString("id")); + jsonData.put("card_id", resultSet.getString("card_id")); + jsonData.put("book_id", resultSet.getString("book_id")); + jsonData.put("borrow_date", resultSet.getString("borrow_date")); + jsonData.put("end_date", resultSet.getString("end_date")); + jsonData.put("return_date", resultSet.getString("return_date")); + jsonData.put("illegal", resultSet.getString("illegal")); + jsonData.put("manager_id", resultSet.getString("manager_id")); + jsonArray.add(jsonData); + } + countSql = "select count(*) as count from borrow_books "; + countSql +=where; + countPstmt = connection.prepareStatement(countSql); + countSet = countPstmt.executeQuery(); + if(countSet.next()) { + count = countSet.getInt("count"); + } + if(!jsonArray.isEmpty()) { + code = 0; + msg = "查询成功"; + } + + } catch (ClassNotFoundException e) { + msg = "class没找到"; + } catch (SQLException e) { + msg = "sql错误"; + } finally { + try { + Base.closeResource(null, pstmt, resultSet); + Base.closeResource(connection, countPstmt, countSet); + } catch (SQLException e) { + msg = "关闭资源失败"; + } + + } + // 返回数据 + jsonResult.put("code", code); + jsonResult.put("count", count); + jsonResult.put("msg", msg); + jsonResult.put("data", jsonArray.toArray()); + PrintWriter out = resp.getWriter(); + out.print(jsonResult.toString()); + } + + + +} diff --git a/src/servlet/admin/CardList.java b/src/servlet/admin/CardList.java index 5930348..c8a897c 100644 --- a/src/servlet/admin/CardList.java +++ b/src/servlet/admin/CardList.java @@ -100,7 +100,6 @@ public class CardList extends HttpServlet { try { Base.closeResource(connection, pstmt, resultSet); } catch (SQLException e) { - // TODO Auto-generated catch block msg = "关闭失败"; } }