├── .gitignore ├── README.md ├── screenshot ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png └── 8.png ├── src └── com │ └── cya │ ├── controller │ ├── AddBookServlet.java │ ├── AddBookTypeServlet.java │ ├── AddNoticeServlet.java │ ├── AddUserServlet.java │ ├── AdminServlet.java │ ├── ExitServlet.java │ ├── LoginServlet.java │ ├── RegisterServlet.java │ ├── borrowServlet.java │ ├── deleteNoticeServlet.java │ ├── deleteServlet.java │ ├── deleteTypeServlet.java │ ├── deleteUserServlet.java │ ├── selectServlet.java │ ├── updateBookServlet.java │ ├── updateBookTypeServlet.java │ ├── updateNoticeServlet.java │ └── updateUserServlet.java │ ├── dao │ ├── AdminDao.java │ ├── BookDao.java │ ├── NoticeDao.java │ └── TypeDao.java │ ├── pojo │ ├── Admin.java │ ├── Book.java │ ├── History.java │ ├── Notice.java │ └── Type.java │ └── util │ └── DBUtil.java └── web ├── WEB-INF ├── lib │ ├── jstl.jar │ ├── mysql-connector-java-5.1.7-bin.jar │ ├── servlet-api.jar │ └── standard.jar └── web.xml ├── books ├── admin │ ├── admin_books.jsp │ ├── admin_booksType.jsp │ ├── admin_borrows.jsp │ ├── admin_history.jsp │ ├── admin_notice.jsp │ ├── admin_users.jsp │ └── index.jsp ├── css │ ├── bootstrap-admin-theme.css │ ├── bootstrap-theme.css │ ├── bootstrap-theme.min.css │ ├── bootstrap.css │ ├── dataTables.bootstrap.css │ └── index.css ├── img │ ├── ghz.jpg │ ├── head_bg.jpg │ ├── login_res_bg.jpg │ ├── title-yellow.png │ └── title-yellow1.png ├── js │ ├── addAdmin.js │ ├── addBook.js │ ├── addBookNum.js │ ├── addBookType.js │ ├── addReader.js │ ├── addReaderType.js │ ├── adminLogin.js │ ├── adminUpdateInfo.js │ ├── adminUpdatePwd.js │ ├── ajax_upload.js │ ├── ajaxfileupload.js │ ├── backBook.js │ ├── batchAddBook.js │ ├── batchAddReader.js │ ├── bootstrap-dropdown.min.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── borrowBook.js │ ├── dataTables.bootstrap.js │ ├── deleteAdmin.js │ ├── deleteBook.js │ ├── deleteBookType.js │ ├── deleteReader.js │ ├── exportBook.js │ ├── exportReader.js │ ├── getAllBookTypes.js │ ├── getAllReaderTypes.js │ ├── getBackInfo.js │ ├── getBookInfo.js │ ├── getBookTypes.js │ ├── getBorrowInfo.js │ ├── getForfeitInfo.js │ ├── getReader.js │ ├── getReaderBackInfo.js │ ├── getReaderBookInfo.js │ ├── getReaderForfeitInfo.js │ ├── index.js │ ├── jquery-3.1.1.min.js │ ├── jquery-3.4.1.js │ ├── jquery.dataTables.zh_CN.js │ ├── login.js │ ├── npm.js │ ├── pay.js │ ├── reader.js │ ├── readerUpdateInfo.js │ ├── readerUpdatePwd.js │ ├── renewBook.js │ ├── updateAdmin.js │ ├── updateAuthorization.js │ ├── updateBook.js │ ├── updateBookType.js │ ├── updateReader.js │ └── updateReaderType.js ├── login.jsp ├── register.jsp └── user │ ├── borrow.jsp │ ├── history.jsp │ ├── index.jsp │ └── select.jsp ├── index.jsp ├── login.jsp └── static ├── css ├── admin.css ├── amazeui.datatables.min.css ├── amazeui.min.css ├── app.css ├── app.less ├── fullcalendar.min.css └── fullcalendar.print.css └── js ├── amazeui.datatables.min.js ├── app.js ├── dataTables.responsive.min.js ├── fullcalendar.min.js ├── jquery.min.js ├── moment.js └── theme.js /.gitignore: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Build Tools 3 | 4 | .gradle 5 | /build/ 6 | !gradle/wrapper/gradle-wrapper.jar 7 | 8 | target/ 9 | !.mvn/wrapper/maven-wrapper.jar 10 | 11 | out/ 12 | 13 | ###################################################################### 14 | # IDE 15 | 16 | ### STS ### 17 | .apt_generated 18 | .classpath 19 | .factorypath 20 | .project 21 | .settings 22 | .springBeans 23 | 24 | ### IntelliJ IDEA ### 25 | .idea 26 | *.iws 27 | *.iml 28 | *.ipr 29 | 30 | ### NetBeans ### 31 | nbproject/private/ 32 | build/* 33 | nbbuild/ 34 | dist/ 35 | nbdist/ 36 | .nb-gradle/ 37 | 38 | ###################################################################### 39 | # Others 40 | *.log 41 | *.xml.versionsBackup 42 | *.swp 43 | 44 | !*/build/*.java 45 | !*/build/*.html 46 | !*/build/*.xml 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

66.图书管理系统

2 | 3 | - 完整代码获取地址:从戎源码网 ([https://armycodes.com/](https://armycodes.com/)) 4 | - 技术探讨、资料分享,请加QQ群:692619798 5 | - 作者微信:19941326836 QQ:952045282 6 | - 承接计算机毕业设计、Java毕业设计、Python毕业设计、深度学习、机器学习 7 | - 选题+开题报告+任务书+程序定制+安装调试+论文+答辩ppt 一条龙服务 8 | - 所有选题地址 ([https://github.com/YuLin-Coder/AllProjectCatalog](https://github.com/YuLin-Coder/AllProjectCatalog)) 9 | 10 | ## 项目介绍 11 | 基于jsp+servlet的图书管理系统:前端jsp、jquery,后端 servlet、jdbc,集成图书管理、图书分类管理、图书借阅、图书归还、公告、读者等功能于一体的系统。 12 | 13 | ## 功能介绍 14 | 15 | ### 管理员 16 | 17 | - 图书管理:图书信息的增删改查,图书名称关键词搜索 18 | - 图书分类管理:图书分类信息的增删改查 19 | - 图书借阅信息:读者借阅记录列表,还书操作 20 | - 图书归还信息:归还信息列表,读者归还记录 21 | - 公告管理:公告信息的增删改查 22 | - 读者管理:读者信息的增删改查,密码设置用于读者登录系统时使用 23 | - 我的:个人信息查看和修改,密码修改 24 | 25 | ### 读者 26 | 27 | - 基本功能:登录、注册、退出、个人信息查看和修改,密码修改 28 | - 图书查询:图书列表,关键词搜索,图书借阅操作 29 | - 借阅信息:借阅操作后会在借阅信息记录里,读者可以自己还书操作 30 | - 借阅历史:已经归还的图书借阅时间和归还时间,在借阅历史里可以查询 31 | 32 | ## 环境 33 | 34 | - IntelliJ IDEA 2021.3 35 | 36 | - Mysql 5.7.26 37 | 38 | - Tomcat 7.0.73 39 | 40 | - JDK 1.8 41 | 42 | ## 运行截图 43 | ![](screenshot/1.png) 44 | 45 | ![](screenshot/2.png) 46 | 47 | ![](screenshot/3.png) 48 | 49 | ![](screenshot/4.png) 50 | 51 | ![](screenshot/5.png) 52 | 53 | ![](screenshot/6.png) 54 | 55 | ![](screenshot/7.png) 56 | 57 | ![](screenshot/8.png) 58 | -------------------------------------------------------------------------------- /screenshot/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/screenshot/1.png -------------------------------------------------------------------------------- /screenshot/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/screenshot/2.png -------------------------------------------------------------------------------- /screenshot/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/screenshot/3.png -------------------------------------------------------------------------------- /screenshot/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/screenshot/4.png -------------------------------------------------------------------------------- /screenshot/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/screenshot/5.png -------------------------------------------------------------------------------- /screenshot/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/screenshot/6.png -------------------------------------------------------------------------------- /screenshot/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/screenshot/7.png -------------------------------------------------------------------------------- /screenshot/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/screenshot/8.png -------------------------------------------------------------------------------- /src/com/cya/controller/AddBookServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import com.cya.dao.BookDao; 11 | 12 | 13 | 14 | /** 15 | * Servlet implementation class AddBookServlet 16 | */ 17 | @WebServlet("/AddBookServlet") 18 | public class AddBookServlet extends jakarta.servlet.http.HttpServlet { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 22 | * @see HttpServlet#HttpServlet() 23 | */ 24 | public AddBookServlet() { 25 | super(); 26 | // TODO Auto-generated constructor stub 27 | } 28 | 29 | /** 30 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 31 | */ 32 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 33 | // TODO Auto-generated method stub 34 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 35 | } 36 | 37 | /** 38 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 39 | */ 40 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 41 | // TODO Auto-generated method stub 42 | // doGet(request, response); 43 | //设置编码类型 44 | request.setCharacterEncoding("UTF-8"); 45 | response.setContentType("text/html;charset=UTF-8"); 46 | //获取要添加图书的信息 47 | String card = request.getParameter("card"); 48 | String name = request.getParameter("name"); 49 | String type = request.getParameter("type"); 50 | String autho = request.getParameter("autho"); 51 | String press = request.getParameter("press"); 52 | int num = Integer.parseInt(request.getParameter("num")); 53 | BookDao bookdao = new BookDao(); 54 | //调用函数,存入图书 55 | bookdao.addBook(card, name, type, autho, press, num); 56 | response.sendRedirect("/manage_books/books/admin/admin_books.jsp"); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/com/cya/controller/AddBookTypeServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import com.cya.dao.TypeDao; 11 | 12 | 13 | /** 14 | * Servlet implementation class AddBookTypeServlet 15 | */ 16 | @WebServlet("/AddBookTypeServlet") 17 | public class AddBookTypeServlet extends HttpServlet { 18 | private static final long serialVersionUID = 1L; 19 | 20 | /** 21 | * @see HttpServlet#HttpServlet() 22 | */ 23 | public AddBookTypeServlet() { 24 | super(); 25 | // TODO Auto-generated constructor stub 26 | } 27 | 28 | /** 29 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 30 | */ 31 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 32 | // TODO Auto-generated method stub 33 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 34 | } 35 | 36 | /** 37 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 38 | */ 39 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 40 | // TODO Auto-generated method stub 41 | // doGet(request, response); 42 | //设置编码类型 43 | request.setCharacterEncoding("UTF-8"); 44 | response.setContentType("text/html;charset=UTF-8"); 45 | //获取图书分类的名称 46 | String name = request.getParameter("name"); 47 | TypeDao typedao = new TypeDao(); 48 | //调用函数存入图书分类信息 49 | typedao.addBookType(name); 50 | response.sendRedirect("/manage_books/books/admin/admin_booksType.jsp"); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/com/cya/controller/AddNoticeServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import java.util.Date; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import org.omg.CORBA.PRIVATE_MEMBER; 13 | 14 | import com.cya.dao.NoticeDao; 15 | import com.cya.pojo.Notice; 16 | 17 | /** 18 | * Servlet implementation class AddNoticeServlet 19 | */ 20 | @WebServlet("/AddNoticeServlet") 21 | public class AddNoticeServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | private String nPerson=""; 25 | private String nContext=""; 26 | /** 27 | * @see HttpServlet#HttpServlet() 28 | */ 29 | public AddNoticeServlet() { 30 | super(); 31 | // TODO Auto-generated constructor stub 32 | } 33 | 34 | /** 35 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 36 | */ 37 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | // TODO Auto-generated method stub 39 | //设置编码类型 40 | request.setCharacterEncoding("UTF-8"); 41 | response.setContentType("text/html;charset=UTF-8"); 42 | nPerson=request.getParameter("nPerson"); 43 | nContext=request.getParameter("nContext"); 44 | System.out.println(nPerson+","+nContext); 45 | 46 | Notice notice=new Notice(); 47 | notice.setnContext(nContext); 48 | notice.setnPerson(nPerson); 49 | notice.setnTime(new Date()); 50 | 51 | NoticeDao noticeDao=new NoticeDao(); 52 | noticeDao.addNotice(notice); 53 | response.sendRedirect("/manage_books/books/admin/admin_notice.jsp"); 54 | } 55 | 56 | /** 57 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 58 | */ 59 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 60 | // TODO Auto-generated method stub 61 | doGet(request, response); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/com/cya/controller/AddUserServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import com.cya.dao.AdminDao; 11 | 12 | 13 | /** 14 | * Servlet implementation class AddUserServlet 15 | */ 16 | @WebServlet("/AddUserServlet") 17 | public class AddUserServlet extends HttpServlet { 18 | private static final long serialVersionUID = 1L; 19 | 20 | /** 21 | * @see HttpServlet#HttpServlet() 22 | */ 23 | public AddUserServlet() { 24 | super(); 25 | // TODO Auto-generated constructor stub 26 | } 27 | 28 | /** 29 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 30 | */ 31 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 32 | // TODO Auto-generated method stub 33 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 34 | } 35 | 36 | /** 37 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 38 | */ 39 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 40 | // TODO Auto-generated method stub 41 | // doGet(request, response); 42 | //设置编码类型 43 | request.setCharacterEncoding("UTF-8"); 44 | response.setContentType("text/html;charset=UTF-8"); 45 | //获取要添加的读者的信息 46 | String username = request.getParameter("username"); 47 | String password = request.getParameter("password"); 48 | String name = request.getParameter("name"); 49 | String email = request.getParameter("email"); 50 | String phone = request.getParameter("phone"); 51 | int lend_num = Integer.parseInt(request.getParameter("lend_num")); 52 | int max_num = Integer.parseInt(request.getParameter("max_num")); 53 | 54 | AdminDao userdao = new AdminDao(); 55 | //调用函数添加读者信息 56 | userdao.Register(username, password, name, email, phone, lend_num, max_num); 57 | response.sendRedirect("/manage_books/books/admin/admin_users.jsp"); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/com/cya/controller/AdminServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import javax.servlet.http.HttpSession; 12 | 13 | import com.cya.dao.AdminDao; 14 | import com.cya.dao.BookDao; 15 | import com.cya.pojo.Admin; 16 | 17 | 18 | /** 19 | * Servlet implementation class AdminServlet 20 | */ 21 | @WebServlet("/AdminServlet") 22 | public class AdminServlet extends HttpServlet { 23 | private static final long serialVersionUID = 1L; 24 | 25 | private String id=""; 26 | /** 27 | * @see HttpServlet#HttpServlet() 28 | */ 29 | public AdminServlet() { 30 | super(); 31 | // TODO Auto-generated constructor stub 32 | } 33 | 34 | /** 35 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 36 | */ 37 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | // TODO Auto-generated method stub 39 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 40 | } 41 | 42 | /** 43 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 44 | */ 45 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 46 | // TODO Auto-generated method stub 47 | // doGet(request, response); 48 | PrintWriter out = response.getWriter(); 49 | //设置编码类型 50 | request.setCharacterEncoding("UTF-8"); 51 | response.setContentType("text/html;charset=UTF-8"); 52 | BookDao bookdao = new BookDao(); 53 | //这里为了简单,设置了tip,用来区分是修改密码功能,还是修改个人资料的功能,tip=1为修改密码 54 | int tip = Integer.parseInt(request.getParameter("tip")); 55 | //获取发起请求页面的文件名称,这个在对应的jsp里面的表单填写,修改完成后就可以直接返回对应的页面 56 | String url = request.getParameter("url"); 57 | System.out.println("url="+url); 58 | HttpSession session = request.getSession(); 59 | Admin adminbean = new Admin(); 60 | if(url.split("/")[0].equals("user")) { 61 | id=(String) session.getAttribute("uid"); 62 | } 63 | else { 64 | id = (String) session.getAttribute("aid"); 65 | } 66 | 67 | AdminDao admindao = new AdminDao(); 68 | //通过aid获取到读者的信息 69 | adminbean = admindao.get_AidInfo2(id); 70 | //修改密码 71 | if (tip == 1) { 72 | //获取到输入的旧密码,新密码 73 | String password = request.getParameter("password"); 74 | String password2 = request.getParameter("password2"); 75 | //获取读者数据表中的密码 76 | String old_password = adminbean.getPassword(); 77 | //对旧密码进行比较,如果相同就修改,不相同就直接退出 78 | if (old_password.equals(password)) { 79 | admindao.updateUser(adminbean.getAid(), adminbean.getUsername(), password2, adminbean.getName(), 80 | adminbean.getEmail(), adminbean.getPhone(), adminbean.getLend_num(), adminbean.getMax_num()); 81 | response.sendRedirect("/manage_books/books/" + url + ".jsp"); 82 | } else { 83 | out.write(""); 84 | 85 | } 86 | } else { 87 | //修改个人资料 88 | //获取输入的信息 89 | String name = request.getParameter("name"); 90 | String email = request.getParameter("email"); 91 | String phone = request.getParameter("phone"); 92 | //修改输入的信息到数据表中 93 | admindao.updateUser(adminbean.getAid(), adminbean.getUsername(), adminbean.getPassword(), name, 94 | email, phone, adminbean.getLend_num(), adminbean.getMax_num()); 95 | 96 | response.sendRedirect("/manage_books/books/" + url + ".jsp"); 97 | } 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /src/com/cya/controller/ExitServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | import javax.servlet.http.HttpSession; 10 | 11 | /** 12 | * Servlet implementation class ExitServlet 13 | */ 14 | @WebServlet("/ExitServlet") 15 | public class ExitServlet extends HttpServlet { 16 | private static final long serialVersionUID = 1L; 17 | 18 | private String url=""; 19 | /** 20 | * @see HttpServlet#HttpServlet() 21 | */ 22 | public ExitServlet() { 23 | super(); 24 | // TODO Auto-generated constructor stub 25 | } 26 | 27 | /** 28 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 29 | */ 30 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 31 | // TODO Auto-generated method stub 32 | String id=request.getParameter("id"); 33 | String status=request.getParameter("status"); 34 | HttpSession session=request.getSession(); 35 | if(status.equals("uid")) { 36 | //用户退出 37 | session.removeAttribute("uid"); 38 | url="./books/user/index.jsp"; 39 | } 40 | else { 41 | //管理员退出 42 | session.removeAttribute("aid"); 43 | url="./books/admin/index.jsp"; 44 | } 45 | response.sendRedirect(url); 46 | } 47 | 48 | /** 49 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 50 | */ 51 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 52 | // TODO Auto-generated method stub 53 | doGet(request, response); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/com/cya/controller/LoginServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import com.cya.dao.AdminDao; 4 | import com.cya.pojo.Admin; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import javax.servlet.http.HttpSession; 12 | import java.io.IOException; 13 | import java.io.PrintWriter; 14 | 15 | /** 16 | * Servlet implementation class LoginServlet 17 | */ 18 | @WebServlet("/LoginServlet") 19 | public class LoginServlet extends HttpServlet { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * @see HttpServlet#HttpServlet() 24 | */ 25 | public LoginServlet() { 26 | super(); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 32 | */ 33 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 34 | // TODO Auto-generated method stub 35 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 36 | } 37 | 38 | /** 39 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 40 | */ 41 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 42 | // TODO Auto-generated method stub 43 | // doGet(request, response); 44 | //登录的判断 45 | PrintWriter out = response.getWriter(); 46 | request.setCharacterEncoding("UTF-8"); 47 | response.setContentType("text/html;charset=UTF-8"); 48 | //获取账号和密码 49 | String username = request.getParameter("username"); 50 | String password = request.getParameter("password"); 51 | AdminDao userdao = new AdminDao(); 52 | //对账号和密码进行判断 53 | boolean result = userdao.Login_verify(username, password); 54 | HttpSession session = request.getSession(); 55 | //判断输入正确 56 | if (result) { 57 | Admin adminbean = new Admin(); 58 | AdminDao admindao = new AdminDao(); 59 | //更加账号和密码查找出读者的信息 60 | adminbean = admindao.getAdminInfo(username, password); 61 | if(adminbean.getStatus()==1) { 62 | //将uid存入session中 63 | session.setAttribute("uid", "" + adminbean.getAid()); 64 | } 65 | else { 66 | //将aid存入session中 67 | session.setAttribute("aid", "" + adminbean.getAid()); 68 | } 69 | 70 | //设置session的失效时间 71 | session.setMaxInactiveInterval(6000); 72 | //根据status的值来判断是管理员,还是读者,status=1为读者 73 | if (adminbean.getStatus() == 1) { 74 | response.sendRedirect("/manage_books/books/user/index.jsp"); 75 | } else { 76 | response.sendRedirect("/manage_books/books/admin/index.jsp"); 77 | } 78 | } else { 79 | //没有找到对应的账号和密码,返回重新登录 80 | session.setAttribute("state", "账号或密码错误"); 81 | response.sendRedirect("/manage_books/books/login.jsp"); 82 | } 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/com/cya/controller/RegisterServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import com.cya.dao.AdminDao; 13 | 14 | /** 15 | * Servlet implementation class RegisterServlet 16 | */ 17 | @WebServlet("/RegisterServlet") 18 | public class RegisterServlet extends HttpServlet { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 22 | * @see HttpServlet#HttpServlet() 23 | */ 24 | public RegisterServlet() { 25 | super(); 26 | // TODO Auto-generated constructor stub 27 | } 28 | 29 | /** 30 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 31 | */ 32 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 33 | // TODO Auto-generated method stub 34 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 35 | } 36 | 37 | /** 38 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 39 | */ 40 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 41 | // TODO Auto-generated method stub 42 | // doGet(request, response); 43 | request.setCharacterEncoding("UTF-8"); 44 | response.setContentType("text/html;charset=UTF-8"); 45 | //获取注册信息 46 | String username = request.getParameter("username"); 47 | String password = request.getParameter("password"); 48 | String name = request.getParameter("name"); 49 | String email = request.getParameter("email"); 50 | String phone = request.getParameter("phone"); 51 | int lend_num = 30; 52 | int max_num = 5; 53 | AdminDao userdao = new AdminDao(); 54 | //将注册信息存入数据库,再返回登录 55 | userdao.Register(username, password, name, email, phone, lend_num, max_num); 56 | response.sendRedirect("/manage-books-ofSystem/login.jsp"); 57 | 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/com/cya/controller/borrowServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import javax.servlet.http.HttpSession; 12 | 13 | import com.cya.pojo.Admin; 14 | import com.cya.dao.AdminDao; 15 | import com.cya.dao.BookDao; 16 | 17 | /** 18 | * Servlet implementation class borrowServlet 19 | */ 20 | @WebServlet("/borrowServlet") 21 | public class borrowServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * @see HttpServlet#HttpServlet() 26 | */ 27 | public borrowServlet() { 28 | super(); 29 | // TODO Auto-generated constructor stub 30 | } 31 | 32 | /** 33 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 34 | */ 35 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 36 | // TODO Auto-generated method stub 37 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 38 | //设置编码类型 39 | request.setCharacterEncoding("UTF-8"); 40 | response.setContentType("text/html;charset=UTF-8"); 41 | BookDao bookdao = new BookDao(); 42 | //为了区分借书和还书的功能,设置tip,tip为1,表示借书 43 | int tip = Integer.parseInt(request.getParameter("tip")); 44 | if (tip == 1) { 45 | //获取图书id 46 | int bid = Integer.parseInt(request.getParameter("bid")); 47 | HttpSession session = request.getSession(); 48 | Admin admin = new Admin(); 49 | String status=request.getParameter("status"); 50 | String id=""; 51 | if(status.equals("user")) { 52 | //获取到存入session的读者id 53 | id = (String) session.getAttribute("uid"); 54 | } 55 | else { 56 | //获取到存入session的aid读者id 57 | id = (String) session.getAttribute("aid"); 58 | } 59 | 60 | AdminDao admindao = new AdminDao(); 61 | //通过aid获取到读者的信息 62 | admin = admindao.get_AidInfo2(id); 63 | //将借阅记录存入数据表 64 | bookdao.borrowBook(bid, admin); 65 | response.sendRedirect("/manage_books/books/user/select.jsp"); 66 | } else { 67 | //还书功能,获取借阅记录的hid 68 | int hid = Integer.parseInt(request.getParameter("hid")); 69 | /** 70 | * 还书在管理员和读者界面都有,为了区分,设置了show字段,show为1表示读者界面 71 | */ 72 | int show = Integer.parseInt(request.getParameter("show")); 73 | //调用还书函数,改变status字段 74 | bookdao.borrowBook2(hid); 75 | if (show == 1) { 76 | response.sendRedirect("/manage_books/books/user/borrow.jsp"); 77 | } else { 78 | response.sendRedirect("/manage_books/books/admin/admin_borrows.jsp"); 79 | } 80 | 81 | } 82 | 83 | } 84 | 85 | /** 86 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 87 | */ 88 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 89 | // TODO Auto-generated method stub 90 | doGet(request, response); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/com/cya/controller/deleteNoticeServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import com.cya.dao.NoticeDao; 11 | 12 | /** 13 | * Servlet implementation class deleteNoticeServlet 14 | */ 15 | @WebServlet("/deleteNoticeServlet") 16 | public class deleteNoticeServlet extends HttpServlet { 17 | private static final long serialVersionUID = 1L; 18 | 19 | /** 20 | * @see HttpServlet#HttpServlet() 21 | */ 22 | public deleteNoticeServlet() { 23 | super(); 24 | // TODO Auto-generated constructor stub 25 | } 26 | 27 | /** 28 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 29 | */ 30 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 31 | // TODO Auto-generated method stub 32 | request.setCharacterEncoding("UTF-8"); 33 | response.setContentType("text/html;charset=UTF-8"); 34 | int nId=Integer.parseInt(request.getParameter("nid")); 35 | NoticeDao noticeDao=new NoticeDao(); 36 | noticeDao.deleteNotice(nId); 37 | response.sendRedirect("/manage_books/books/admin/admin_notice.jsp"); 38 | } 39 | 40 | /** 41 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 42 | */ 43 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 44 | // TODO Auto-generated method stub 45 | doGet(request, response); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/com/cya/controller/deleteServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import com.cya.dao.BookDao; 13 | 14 | /** 15 | * Servlet implementation class deleteServlet 16 | */ 17 | @WebServlet("/deleteServlet") 18 | public class deleteServlet extends HttpServlet { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 22 | * @see HttpServlet#HttpServlet() 23 | */ 24 | public deleteServlet() { 25 | super(); 26 | // TODO Auto-generated constructor stub 27 | } 28 | 29 | /** 30 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 31 | */ 32 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 33 | // TODO Auto-generated method stub 34 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 35 | //删除图书信息 36 | request.setCharacterEncoding("UTF-8"); 37 | response.setContentType("text/html;charset=UTF-8"); 38 | int bid = Integer.parseInt(request.getParameter("bid")); 39 | BookDao bookdao = new BookDao(); 40 | bookdao.deleteBook(bid); 41 | response.sendRedirect("/manage_books/books/admin/admin_books.jsp"); 42 | } 43 | 44 | /** 45 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 46 | */ 47 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 48 | // TODO Auto-generated method stub 49 | doGet(request, response); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/com/cya/controller/deleteTypeServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import com.cya.dao.TypeDao; 11 | 12 | 13 | 14 | /** 15 | * Servlet implementation class deleteTypeServlet 16 | */ 17 | @WebServlet("/deleteTypeServlet") 18 | public class deleteTypeServlet extends HttpServlet { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 22 | * @see HttpServlet#HttpServlet() 23 | */ 24 | public deleteTypeServlet() { 25 | super(); 26 | // TODO Auto-generated constructor stub 27 | } 28 | 29 | /** 30 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 31 | */ 32 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 33 | // TODO Auto-generated method stub 34 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 35 | //删除图书分类信息 36 | request.setCharacterEncoding("UTF-8"); 37 | response.setContentType("text/html;charset=UTF-8"); 38 | int tid = Integer.parseInt(request.getParameter("tid")); 39 | TypeDao typedao = new TypeDao(); 40 | typedao.deleteBookType(tid); 41 | response.sendRedirect("/manage_books/books/admin/admin_booksType.jsp"); 42 | } 43 | 44 | /** 45 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 46 | */ 47 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 48 | // TODO Auto-generated method stub 49 | doGet(request, response); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/com/cya/controller/deleteUserServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import com.cya.dao.AdminDao; 11 | import com.cya.dao.TypeDao; 12 | 13 | /** 14 | * Servlet implementation class deleteUserServlet 15 | */ 16 | @WebServlet("/deleteUserServlet") 17 | public class deleteUserServlet extends HttpServlet { 18 | private static final long serialVersionUID = 1L; 19 | 20 | /** 21 | * @see HttpServlet#HttpServlet() 22 | */ 23 | public deleteUserServlet() { 24 | super(); 25 | // TODO Auto-generated constructor stub 26 | } 27 | 28 | /** 29 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 30 | */ 31 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 32 | // TODO Auto-generated method stub 33 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 34 | //删除读者信息 35 | request.setCharacterEncoding("UTF-8"); 36 | response.setContentType("text/html;charset=UTF-8"); 37 | int aid = Integer.parseInt(request.getParameter("aid")); 38 | AdminDao admindao = new AdminDao(); 39 | admindao.deleteUser(aid); 40 | response.sendRedirect("/manage_books/books/admin/admin_users.jsp"); 41 | } 42 | 43 | /** 44 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 45 | */ 46 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 47 | // TODO Auto-generated method stub 48 | doGet(request, response); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/com/cya/controller/selectServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | 4 | import java.io.IOException; 5 | import java.util.ArrayList; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.annotation.WebServlet; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | 14 | import com.cya.dao.BookDao; 15 | import com.cya.pojo.Book; 16 | 17 | /** 18 | * Servlet implementation class selectServlet 19 | */ 20 | @WebServlet("/selectServlet") 21 | public class selectServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * @see HttpServlet#HttpServlet() 26 | */ 27 | public selectServlet() { 28 | super(); 29 | // TODO Auto-generated constructor stub 30 | } 31 | 32 | /** 33 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 34 | */ 35 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 36 | // TODO Auto-generated method stub 37 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 38 | 39 | } 40 | 41 | /** 42 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 43 | */ 44 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 45 | // TODO Auto-generated method stub 46 | // doGet(request, response); 47 | request.setCharacterEncoding("UTF-8"); 48 | response.setContentType("text/html;charset=UTF-8"); 49 | //因为在管理员界面和读者界面都有查找功能,为了将查找的结果返回正确的页面,设置了tip,tip=1表示管理员界面 50 | int tip = Integer.parseInt(request.getParameter("tip")); 51 | String name = request.getParameter("name"); 52 | BookDao bookdao = new BookDao(); 53 | ArrayList data = bookdao.getLikeList(name); 54 | //将获取的结果存入请求中 55 | request.setAttribute("data", data); 56 | String url = ""; 57 | //转发不同的界面 58 | if (tip == 1) { 59 | url = response.encodeURL("/books/admin/admin_books.jsp"); 60 | } else { 61 | url = response.encodeURL("/books/user/select.jsp"); 62 | } 63 | //将请求转发 64 | request.getRequestDispatcher(url).forward(request, response); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/com/cya/controller/updateBookServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import com.cya.dao.BookDao; 13 | 14 | /** 15 | * Servlet implementation class updateBookServlet 16 | */ 17 | @WebServlet("/updateBookServlet") 18 | public class updateBookServlet extends HttpServlet { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 22 | * @see HttpServlet#HttpServlet() 23 | */ 24 | public updateBookServlet() { 25 | super(); 26 | // TODO Auto-generated constructor stub 27 | } 28 | 29 | /** 30 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 31 | */ 32 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 33 | // TODO Auto-generated method stub 34 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 35 | } 36 | 37 | /** 38 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 39 | */ 40 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 41 | // TODO Auto-generated method stub 42 | // doGet(request, response); 43 | //修改图书信息 44 | request.setCharacterEncoding("UTF-8"); 45 | response.setContentType("text/html;charset=UTF-8"); 46 | String card = request.getParameter("card"); 47 | String name = request.getParameter("name"); 48 | String type = request.getParameter("type"); 49 | String autho = request.getParameter("autho"); 50 | String press = request.getParameter("press"); 51 | int num = Integer.parseInt(request.getParameter("num")); 52 | int bid = Integer.parseInt(request.getParameter("updatebid")); 53 | BookDao bookdao = new BookDao(); 54 | bookdao.updateBook(bid, card, name, type, autho, press, num); 55 | response.sendRedirect("/manage_books/books/admin/admin_books.jsp"); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/com/cya/controller/updateBookTypeServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import com.cya.dao.BookDao; 11 | import com.cya.dao.TypeDao; 12 | 13 | /** 14 | * Servlet implementation class updateBookTypeServlet 15 | */ 16 | @WebServlet("/updateBookTypeServlet") 17 | public class updateBookTypeServlet extends HttpServlet { 18 | private static final long serialVersionUID = 1L; 19 | 20 | /** 21 | * @see HttpServlet#HttpServlet() 22 | */ 23 | public updateBookTypeServlet() { 24 | super(); 25 | // TODO Auto-generated constructor stub 26 | } 27 | 28 | /** 29 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 30 | */ 31 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 32 | // TODO Auto-generated method stub 33 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 34 | } 35 | 36 | /** 37 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 38 | */ 39 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 40 | // TODO Auto-generated method stub 41 | // doGet(request, response); 42 | //修改图书类型信息 43 | request.setCharacterEncoding("UTF-8"); 44 | response.setContentType("text/html;charset=UTF-8"); 45 | String name = request.getParameter("name"); 46 | int tid = Integer.parseInt(request.getParameter("tid")); 47 | TypeDao typedao = new TypeDao(); 48 | typedao.updateTypeBook(tid, name); 49 | response.sendRedirect("/manage_books/books/admin/admin_booksType.jsp"); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/com/cya/controller/updateNoticeServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import java.util.Date; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import com.cya.dao.NoticeDao; 13 | import com.cya.pojo.Notice; 14 | 15 | /** 16 | * Servlet implementation class updateNoticeServlet 17 | */ 18 | @WebServlet("/updateNoticeServlet") 19 | public class updateNoticeServlet extends HttpServlet { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * @see HttpServlet#HttpServlet() 24 | */ 25 | public updateNoticeServlet() { 26 | super(); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 32 | */ 33 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 34 | // TODO Auto-generated method stub 35 | request.setCharacterEncoding("UTF-8"); 36 | response.setContentType("text/html;charset=UTF-8"); 37 | String nContext=request.getParameter("nContext"); 38 | int nId=0; 39 | if(request.getParameter("nId")!=null && request.getParameter("nId")!="") { 40 | nId=Integer.parseInt(request.getParameter("nId")); 41 | } 42 | Notice notice=new Notice(); 43 | notice.setnContext(nContext); 44 | notice.setnId(nId); 45 | notice.setnTime(new Date()); 46 | NoticeDao noticeDao=new NoticeDao(); 47 | noticeDao.updateNotice(notice); 48 | response.sendRedirect("/manage_books/books/admin/admin_notice.jsp"); 49 | 50 | } 51 | 52 | /** 53 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 54 | */ 55 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 56 | // TODO Auto-generated method stub 57 | doGet(request, response); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/com/cya/controller/updateUserServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import com.cya.dao.AdminDao; 11 | 12 | 13 | /** 14 | * Servlet implementation class updateUserServlet 15 | */ 16 | @WebServlet("/updateUserServlet") 17 | public class updateUserServlet extends HttpServlet { 18 | private static final long serialVersionUID = 1L; 19 | 20 | /** 21 | * @see HttpServlet#HttpServlet() 22 | */ 23 | public updateUserServlet() { 24 | super(); 25 | // TODO Auto-generated constructor stub 26 | } 27 | 28 | /** 29 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 30 | */ 31 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 32 | // TODO Auto-generated method stub 33 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 34 | } 35 | 36 | /** 37 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 38 | */ 39 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 40 | // TODO Auto-generated method stub 41 | // doGet(request, response); 42 | //修改读者的信息 43 | request.setCharacterEncoding("UTF-8"); 44 | response.setContentType("text/html;charset=UTF-8"); 45 | String username = request.getParameter("username"); 46 | String password = request.getParameter("password"); 47 | String name = request.getParameter("name"); 48 | String email = request.getParameter("email"); 49 | String phone = request.getParameter("phone"); 50 | int lend_num = Integer.parseInt(request.getParameter("lend_num")); 51 | int max_num = Integer.parseInt(request.getParameter("max_num")); 52 | int aid = Integer.parseInt(request.getParameter("aid")); 53 | AdminDao userdao = new AdminDao(); 54 | userdao.updateUser(aid, username, password, name, email, phone, lend_num, max_num); 55 | response.sendRedirect("/manage_books/books/admin/admin_users.jsp"); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/com/cya/dao/NoticeDao.java: -------------------------------------------------------------------------------- 1 | package com.cya.dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.util.ArrayList; 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | import com.cya.pojo.Notice; 12 | import com.cya.util.DBUtil; 13 | 14 | public class NoticeDao { 15 | 16 | public void addNotice(Notice notice) { 17 | Connection conn = DBUtil.getConnectDb(); 18 | String sql = "insert into notice(nTime,nPerson,nContext) values(?,?,?)"; 19 | PreparedStatement stm = null; 20 | try { 21 | stm = conn.prepareStatement(sql); 22 | 23 | Date utilDate = notice.getnTime(); 24 | //util.Date转sql.Date 25 | java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime()); 26 | stm.setDate(1, sqlDate); 27 | stm.setString(2, notice.getnPerson()); 28 | stm.setString(3, notice.getnContext()); 29 | stm.executeUpdate(); 30 | } catch (SQLException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | } 35 | 36 | public List get_ListInfo(){ 37 | List tag_Array=new ArrayList<>(); 38 | Connection connection=DBUtil.getConnectDb(); 39 | String sql = "select * from notice"; 40 | PreparedStatement stm = null; 41 | ResultSet rs = null; 42 | try { 43 | stm = connection.prepareStatement(sql); 44 | rs = stm.executeQuery(); 45 | while(rs.next()) { 46 | Notice notice=new Notice(); 47 | notice.setnId(rs.getInt("nId")); 48 | notice.setnContext(rs.getString("nContext")); 49 | notice.setnPerson(rs.getString("nPerson")); 50 | notice.setnTime(rs.getDate("nTime")); 51 | tag_Array.add(notice); 52 | } 53 | } catch (SQLException e) { 54 | // TODO Auto-generated catch block 55 | e.printStackTrace(); 56 | }finally{ 57 | DBUtil.CloseDB(rs, stm, connection); 58 | } 59 | return tag_Array; 60 | } 61 | 62 | public void updateNotice(Notice notice) { 63 | Connection conn = DBUtil.getConnectDb(); 64 | String sql = "update notice set nTime=?,nContext=? where nId=?"; 65 | PreparedStatement stm = null; 66 | try { 67 | stm = conn.prepareStatement(sql); 68 | Date utilDate = notice.getnTime(); 69 | //util.Date转sql.Date 70 | java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime()); 71 | stm.setDate(1, sqlDate); 72 | stm.setString(2, notice.getnContext()); 73 | stm.setInt(3, notice.getnId()); 74 | stm.executeUpdate(); 75 | } catch (SQLException e) { 76 | // TODO Auto-generated catch block 77 | e.printStackTrace(); 78 | } 79 | } 80 | 81 | public void deleteNotice(int nId) { 82 | Connection conn = DBUtil.getConnectDb(); 83 | String sql = "delete from notice where nId=?"; 84 | PreparedStatement stm = null; 85 | try { 86 | stm = conn.prepareStatement(sql); 87 | stm.setInt(1, nId); 88 | stm.executeUpdate(); 89 | } catch (SQLException e) { 90 | // TODO Auto-generated catch block 91 | e.printStackTrace(); 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/com/cya/dao/TypeDao.java: -------------------------------------------------------------------------------- 1 | package com.cya.dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.util.ArrayList; 8 | 9 | import com.cya.pojo.Type; 10 | import com.cya.util.DBUtil; 11 | 12 | 13 | 14 | /** 15 | * 图书分类的类 16 | */ 17 | public class TypeDao { 18 | /** 19 | * 获取所有图书类型的信息,返回数组形式 20 | * 21 | * @return 22 | */ 23 | public ArrayList get_ListInfo() { 24 | ArrayList tag_Array = new ArrayList(); 25 | Connection conn = DBUtil.getConnectDb(); 26 | String sql = "select * from booktype"; 27 | PreparedStatement stm = null; 28 | ResultSet rs = null; 29 | try { 30 | stm = conn.prepareStatement(sql); 31 | rs = stm.executeQuery(); 32 | while (rs.next()) { 33 | Type tag = new Type(); 34 | tag.setTid(rs.getInt("tid")); 35 | tag.setName(rs.getString("name")); 36 | tag_Array.add(tag); 37 | } 38 | } catch (SQLException e) { 39 | // TODO Auto-generated catch block 40 | e.printStackTrace(); 41 | } finally { 42 | DBUtil.CloseDB(rs, stm, conn); 43 | } 44 | return tag_Array; 45 | } 46 | 47 | /** 48 | * 修改图书分类的信息 49 | * 50 | * @param tid 51 | * @param name 52 | */ 53 | public void updateTypeBook(int tid, String name) { 54 | // TODO Auto-generated method stub 55 | Connection conn = DBUtil.getConnectDb(); 56 | String sql = "update booktype set name=? where tid=?"; 57 | PreparedStatement stm = null; 58 | try { 59 | stm = conn.prepareStatement(sql); 60 | stm.setString(1, name); 61 | stm.setInt(2, tid); 62 | stm.executeUpdate(); 63 | } catch (SQLException e) { 64 | // TODO Auto-generated catch block 65 | e.printStackTrace(); 66 | } 67 | } 68 | 69 | /** 70 | * 添加一个图书分类 71 | * 72 | * @param name 73 | */ 74 | public void addBookType(String name) { 75 | // TODO Auto-generated method stub 76 | Connection conn = DBUtil.getConnectDb(); 77 | String sql = "insert into booktype(name) values(?)"; 78 | int rs = 0; 79 | PreparedStatement stm = null; 80 | try { 81 | stm = conn.prepareStatement(sql); 82 | stm.setString(1, name); 83 | ; 84 | rs = stm.executeUpdate(); 85 | } catch (SQLException e) { 86 | // TODO Auto-generated catch block 87 | e.printStackTrace(); 88 | } 89 | } 90 | 91 | /** 92 | * 删除一个图书分类 93 | * 94 | * @param tid 95 | */ 96 | public void deleteBookType(int tid) { 97 | // TODO Auto-generated method stub 98 | Connection conn = DBUtil.getConnectDb(); 99 | String sql = "delete from booktype where tid=?"; 100 | PreparedStatement stm = null; 101 | try { 102 | stm = conn.prepareStatement(sql); 103 | stm.setInt(1, tid); 104 | stm.executeUpdate(); 105 | } catch (SQLException e) { 106 | // TODO Auto-generated catch block 107 | e.printStackTrace(); 108 | } 109 | //System.out.println(uid); 110 | 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/com/cya/pojo/Admin.java: -------------------------------------------------------------------------------- 1 | package com.cya.pojo; 2 | 3 | public class Admin { 4 | public Admin() { 5 | super(); 6 | // TODO Auto-generated constructor stub 7 | } 8 | 9 | /** 10 | * 用户的数据表的bean 11 | */ 12 | private int aid;//id 13 | private int status;//用来判断是管理员还是读者,读者的值为1,管理员为2 14 | private String username;//账号, 15 | private String name;//读者的姓名 16 | private String password;//密码 17 | private String email;//邮箱 18 | private String phone;//手机号 19 | private int lend_num;//可借阅天数 20 | private int max_num;//最大可借数 21 | 22 | public int getAid() { 23 | return aid; 24 | } 25 | 26 | public void setAid(int aid) { 27 | this.aid = aid; 28 | } 29 | 30 | public int getStatus() { 31 | return status; 32 | } 33 | 34 | public void setStatus(int status) { 35 | this.status = status; 36 | } 37 | 38 | public String getUsername() { 39 | return username; 40 | } 41 | 42 | public void setUsername(String username) { 43 | this.username = username; 44 | } 45 | 46 | public String getName() { 47 | return name; 48 | } 49 | 50 | public void setName(String name) { 51 | this.name = name; 52 | } 53 | 54 | public String getPassword() { 55 | return password; 56 | } 57 | 58 | public void setPassword(String password) { 59 | this.password = password; 60 | } 61 | 62 | public String getEmail() { 63 | return email; 64 | } 65 | 66 | public void setEmail(String email) { 67 | this.email = email; 68 | } 69 | 70 | public String getPhone() { 71 | return phone; 72 | } 73 | 74 | public void setPhone(String phone) { 75 | this.phone = phone; 76 | } 77 | 78 | public int getLend_num() { 79 | return lend_num; 80 | } 81 | 82 | public void setLend_num(int lend_num) { 83 | this.lend_num = lend_num; 84 | } 85 | 86 | public int getMax_num() { 87 | return max_num; 88 | } 89 | 90 | public void setMax_num(int max_num) { 91 | this.max_num = max_num; 92 | } 93 | 94 | @Override 95 | public String toString() { 96 | return "Admin [aid=" + aid + ", status=" + status + ", username=" + username + ", name=" + name + ", password=" 97 | + password + ", email=" + email + ", phone=" + phone + ", lend_num=" + lend_num + ", max_num=" + max_num 98 | + "]"; 99 | } 100 | 101 | 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/com/cya/pojo/Book.java: -------------------------------------------------------------------------------- 1 | package com.cya.pojo; 2 | 3 | public class Book { 4 | /** 5 | * 图书的数据表的bean 6 | */ 7 | private int bid;//id 8 | private String name;//图书名称 9 | private String card;//图书号 10 | private String autho;//作者 11 | private int num;//图书数量 12 | private String type;//图书的分类 13 | private String press;//出版社 14 | 15 | public int getBid() { 16 | return bid; 17 | } 18 | 19 | public void setBid(int bid) { 20 | this.bid = bid; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | public String getCard() { 32 | return card; 33 | } 34 | 35 | public void setCard(String card) { 36 | this.card = card; 37 | } 38 | 39 | public String getAutho() { 40 | return autho; 41 | } 42 | 43 | public void setAutho(String autho) { 44 | this.autho = autho; 45 | } 46 | 47 | public int getNum() { 48 | return num; 49 | } 50 | 51 | public void setNum(int num) { 52 | this.num = num; 53 | } 54 | 55 | public String getType() { 56 | return type; 57 | } 58 | 59 | public void setType(String type) { 60 | this.type = type; 61 | } 62 | 63 | public String getPress() { 64 | return press; 65 | } 66 | 67 | public void setPress(String press) { 68 | this.press = press; 69 | } 70 | 71 | @Override 72 | public String toString() { 73 | return "Book [bid=" + bid + ", name=" + name + ", card=" + card + ", autho=" + autho + ", num=" + num 74 | + ", type=" + type + ", press=" + press + "]"; 75 | } 76 | 77 | 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/com/cya/pojo/History.java: -------------------------------------------------------------------------------- 1 | package com.cya.pojo; 2 | 3 | public class History { 4 | /** 5 | * 历史借阅记录的数据表的bean 6 | */ 7 | private int hid;//借阅记录的id 8 | private int aid;//读者的id 9 | private int bid;//图书的id 10 | private String card;//图书号 11 | private String bookname;//图书名称 12 | private String adminname;//读者的账号 13 | private String username;//读者的姓名 14 | private String begintime;//借阅时间 15 | private String endtime;//要还书的世界 16 | private int status;//表示借阅状态,1为正在借阅,2是已经还书 17 | 18 | public int getHid() { 19 | return hid; 20 | } 21 | 22 | public void setHid(int hid) { 23 | this.hid = hid; 24 | } 25 | 26 | public int getAid() { 27 | return aid; 28 | } 29 | 30 | public void setAid(int aid) { 31 | this.aid = aid; 32 | } 33 | 34 | public int getBid() { 35 | return bid; 36 | } 37 | 38 | public void setBid(int bid) { 39 | this.bid = bid; 40 | } 41 | 42 | public String getCard() { 43 | return card; 44 | } 45 | 46 | public void setCard(String card) { 47 | this.card = card; 48 | } 49 | 50 | public String getBookname() { 51 | return bookname; 52 | } 53 | 54 | public void setBookname(String bookname) { 55 | this.bookname = bookname; 56 | } 57 | 58 | public String getAdminname() { 59 | return adminname; 60 | } 61 | 62 | public void setAdminname(String adminname) { 63 | this.adminname = adminname; 64 | } 65 | 66 | public String getUsername() { 67 | return username; 68 | } 69 | 70 | public void setUsername(String username) { 71 | this.username = username; 72 | } 73 | 74 | public String getBegintime() { 75 | return begintime; 76 | } 77 | 78 | public void setBegintime(String begintime) { 79 | this.begintime = begintime; 80 | } 81 | 82 | public String getEndtime() { 83 | return endtime; 84 | } 85 | 86 | public void setEndtime(String endtime) { 87 | this.endtime = endtime; 88 | } 89 | 90 | public int getStatus() { 91 | return status; 92 | } 93 | 94 | public void setStatus(int status) { 95 | this.status = status; 96 | } 97 | 98 | @Override 99 | public String toString() { 100 | return "History [hid=" + hid + ", aid=" + aid + ", bid=" + bid + ", card=" + card + ", bookname=" + bookname 101 | + ", adminname=" + adminname + ", username=" + username + ", begintime=" + begintime + ", endtime=" 102 | + endtime + ", status=" + status + "]"; 103 | } 104 | 105 | 106 | 107 | } 108 | -------------------------------------------------------------------------------- /src/com/cya/pojo/Notice.java: -------------------------------------------------------------------------------- 1 | package com.cya.pojo; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * 公告 7 | * @author 蜡笔小新 8 | * 9 | */ 10 | public class Notice { 11 | private int nId; //公告id 12 | private Date nTime; //发布时间 13 | private String nPerson; //发布人 14 | private String nContext; //发布内容 15 | public int getnId() { 16 | return nId; 17 | } 18 | public void setnId(int nId) { 19 | this.nId = nId; 20 | } 21 | public Date getnTime() { 22 | return nTime; 23 | } 24 | public void setnTime(Date nTime) { 25 | this.nTime = nTime; 26 | } 27 | public String getnPerson() { 28 | return nPerson; 29 | } 30 | public void setnPerson(String nPerson) { 31 | this.nPerson = nPerson; 32 | } 33 | public String getnContext() { 34 | return nContext; 35 | } 36 | public void setnContext(String nContext) { 37 | this.nContext = nContext; 38 | } 39 | @Override 40 | public String toString() { 41 | return "Notice [nId=" + nId + ", nTime=" + nTime + ", nPerson=" + nPerson + ", nContext=" + nContext + "]"; 42 | } 43 | 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/com/cya/pojo/Type.java: -------------------------------------------------------------------------------- 1 | package com.cya.pojo; 2 | 3 | public class Type { 4 | /** 5 | * 图书分类的数据表的bean 6 | */ 7 | private int tid;//分类的id 8 | private String name;//分类的名称 9 | 10 | public int getTid() { 11 | return tid; 12 | } 13 | 14 | public void setTid(int tid) { 15 | this.tid = tid; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return "Type [tid=" + tid + ", name=" + name + "]"; 29 | } 30 | 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/com/cya/util/DBUtil.java: -------------------------------------------------------------------------------- 1 | package com.cya.util; 2 | 3 | import java.sql.Connection; 4 | import java.sql.DriverManager; 5 | import java.sql.PreparedStatement; 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | public class DBUtil { 10 | /** 11 | * 连接数据库的操作,用户名,密码,使用jdbc连接 12 | */ 13 | public static String username = "root"; 14 | public static String password = "123456"; 15 | public static String url = "jdbc:mysql://localhost:3306/no66_books"; 16 | 17 | static { 18 | try { 19 | Class.forName("com.mysql.jdbc.Driver"); 20 | } catch (ClassNotFoundException e) { 21 | e.printStackTrace(); 22 | } 23 | } 24 | 25 | public static Connection getConnectDb() { 26 | Connection conn = null; 27 | try { 28 | conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/no66_books", username, password); 29 | 30 | } catch (SQLException e) { 31 | e.printStackTrace(); 32 | } 33 | return conn; 34 | } 35 | 36 | public static void CloseDB(ResultSet rs, PreparedStatement stm, Connection conn) { 37 | if (rs != null) { 38 | try { 39 | rs.close(); 40 | } catch (SQLException e) { 41 | // TODO Auto-generated catch block 42 | e.printStackTrace(); 43 | } 44 | } 45 | if (stm != null) { 46 | try { 47 | stm.close(); 48 | } catch (SQLException e) { 49 | // TODO Auto-generated catch block 50 | e.printStackTrace(); 51 | } 52 | } 53 | if (conn != null) { 54 | try { 55 | conn.close(); 56 | } catch (SQLException e) { 57 | // TODO Auto-generated catch block 58 | e.printStackTrace(); 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /web/WEB-INF/lib/jstl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/web/WEB-INF/lib/jstl.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/mysql-connector-java-5.1.7-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/web/WEB-INF/lib/mysql-connector-java-5.1.7-bin.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/servlet-api.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/web/WEB-INF/lib/servlet-api.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/standard.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/web/WEB-INF/lib/standard.jar -------------------------------------------------------------------------------- /web/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | books/login.jsp 9 | 10 | -------------------------------------------------------------------------------- /web/books/css/dataTables.bootstrap.css: -------------------------------------------------------------------------------- 1 | table.dataTable { 2 | clear: both; 3 | margin-top: 6px !important; 4 | margin-bottom: 6px !important; 5 | max-width: none !important; 6 | } 7 | 8 | table.dataTable td, 9 | table.dataTable th { 10 | -webkit-box-sizing: content-box; 11 | -moz-box-sizing: content-box; 12 | box-sizing: content-box; 13 | } 14 | 15 | table.dataTable.nowrap th, 16 | table.dataTable.nowrap td { 17 | white-space: nowrap; 18 | } 19 | 20 | div.dataTables_wrapper div.dataTables_length label { 21 | font-weight: normal; 22 | text-align: left; 23 | white-space: nowrap; 24 | } 25 | 26 | div.dataTables_wrapper div.dataTables_length select { 27 | width: 75px; 28 | display: inline-block; 29 | } 30 | 31 | div.dataTables_wrapper div.dataTables_filter { 32 | text-align: right; 33 | } 34 | 35 | div.dataTables_wrapper div.dataTables_filter label { 36 | font-weight: normal; 37 | white-space: nowrap; 38 | text-align: left; 39 | } 40 | 41 | div.dataTables_wrapper div.dataTables_filter input { 42 | margin-left: 0.5em; 43 | display: inline-block; 44 | width: auto; 45 | } 46 | 47 | div.dataTables_wrapper div.dataTables_info { 48 | padding-top: 8px; 49 | white-space: nowrap; 50 | } 51 | 52 | div.dataTables_wrapper div.dataTables_paginate { 53 | margin: 0; 54 | white-space: nowrap; 55 | text-align: right; 56 | } 57 | 58 | div.dataTables_wrapper div.dataTables_paginate ul.pagination { 59 | margin: 2px 0; 60 | white-space: nowrap; 61 | } 62 | 63 | table.dataTable thead > tr > th, 64 | table.dataTable thead > tr > td { 65 | padding-right: 30px; 66 | } 67 | 68 | table.dataTable thead > tr > th:active, 69 | table.dataTable thead > tr > td:active { 70 | outline: none; 71 | } 72 | 73 | table.dataTable thead .sorting, 74 | table.dataTable thead .sorting_asc, 75 | table.dataTable thead .sorting_desc, 76 | table.dataTable thead .sorting_asc_disabled, 77 | table.dataTable thead .sorting_desc_disabled { 78 | cursor: pointer; 79 | position: relative; 80 | } 81 | 82 | table.dataTable thead .sorting:after, 83 | table.dataTable thead .sorting_asc:after, 84 | table.dataTable thead .sorting_desc:after, 85 | table.dataTable thead .sorting_asc_disabled:after, 86 | table.dataTable thead .sorting_desc_disabled:after { 87 | position: absolute; 88 | bottom: 8px; 89 | right: 8px; 90 | display: block; 91 | font-family: 'Glyphicons Halflings'; 92 | opacity: 0.5; 93 | } 94 | 95 | table.dataTable thead .sorting:after { 96 | opacity: 0.2; 97 | content: "\e150"; 98 | /* sort */ 99 | } 100 | 101 | table.dataTable thead .sorting_asc:after { 102 | content: "\e155"; 103 | /* sort-by-attributes */ 104 | } 105 | 106 | table.dataTable thead .sorting_desc:after { 107 | content: "\e156"; 108 | /* sort-by-attributes-alt */ 109 | } 110 | 111 | table.dataTable thead .sorting_asc_disabled:after, 112 | table.dataTable thead .sorting_desc_disabled:after { 113 | color: #eee; 114 | } 115 | 116 | div.dataTables_scrollHead table.dataTable { 117 | margin-bottom: 0 !important; 118 | } 119 | 120 | div.dataTables_scrollBody table { 121 | border-top: none; 122 | margin-top: 0 !important; 123 | margin-bottom: 0 !important; 124 | } 125 | 126 | div.dataTables_scrollBody table thead .sorting:after, 127 | div.dataTables_scrollBody table thead .sorting_asc:after, 128 | div.dataTables_scrollBody table thead .sorting_desc:after { 129 | display: none; 130 | } 131 | 132 | div.dataTables_scrollBody table tbody tr:first-child th, 133 | div.dataTables_scrollBody table tbody tr:first-child td { 134 | border-top: none; 135 | } 136 | 137 | div.dataTables_scrollFoot table { 138 | margin-top: 0 !important; 139 | border-top: none; 140 | } 141 | 142 | @media screen and (max-width: 767px) { 143 | div.dataTables_wrapper div.dataTables_length, 144 | div.dataTables_wrapper div.dataTables_filter, 145 | div.dataTables_wrapper div.dataTables_info, 146 | div.dataTables_wrapper div.dataTables_paginate { 147 | text-align: center; 148 | } 149 | } 150 | 151 | table.dataTable.table-condensed > thead > tr > th { 152 | padding-right: 20px; 153 | } 154 | 155 | table.dataTable.table-condensed .sorting:after, 156 | table.dataTable.table-condensed .sorting_asc:after, 157 | table.dataTable.table-condensed .sorting_desc:after { 158 | top: 6px; 159 | right: 6px; 160 | } 161 | 162 | table.table-bordered.dataTable { 163 | border-collapse: separate !important; 164 | } 165 | 166 | table.table-bordered.dataTable th, 167 | table.table-bordered.dataTable td { 168 | border-left-width: 0; 169 | } 170 | 171 | table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, 172 | table.table-bordered.dataTable td:last-child, 173 | table.table-bordered.dataTable td:last-child { 174 | border-right-width: 0; 175 | } 176 | 177 | table.table-bordered.dataTable tbody th, 178 | table.table-bordered.dataTable tbody td { 179 | border-bottom-width: 0; 180 | } 181 | 182 | div.dataTables_scrollHead table.table-bordered { 183 | border-bottom-width: 0; 184 | } 185 | -------------------------------------------------------------------------------- /web/books/css/index.css: -------------------------------------------------------------------------------- 1 | /*head*/ 2 | 3 | *{ 4 | padding: 0; 5 | margin: 0; 6 | } 7 | ul li{ 8 | list-style: none; 9 | } 10 | a{ 11 | text-decoration: none; 12 | } 13 | .head{ 14 | position: absolute; 15 | width: 100%; 16 | height: 310px; 17 | background-image: url(../img/head_bg.jpg); 18 | background-size: 100%; 19 | background-repeat:no-repeat; 20 | } 21 | 22 | .head .img{ 23 | position: relative; 24 | top: 10%; 25 | } 26 | .head .daohang{ 27 | width: 100%; 28 | height: 50px; 29 | position: absolute; 30 | bottom: 0; 31 | left: 0; 32 | background-color: #169fe6; 33 | opacity: 0.85; 34 | } 35 | 36 | .head .daohang ul li{ 37 | float: left; 38 | width: 150px; 39 | height: 50px; 40 | margin-left: 10px; 41 | text-align: center; 42 | line-height: 50px; 43 | font-size: 20px; 44 | color: #fff; 45 | } 46 | .head .daohang ul li a:hover{ 47 | background-color: #fff; 48 | color: #169fe6; 49 | } 50 | .head .daohang ul li a{ 51 | width: 100%; 52 | height: 100%; 53 | display: block; 54 | color: #fff; 55 | text-decoration: none; 56 | } 57 | 58 | .head .userName{ 59 | position: absolute; 60 | z-index: 10; 61 | top: 28%; 62 | font-size: 30px; 63 | color: #fff; 64 | left: 6.8%; 65 | width: 310px; 66 | height: 110px; 67 | text-align: center; 68 | line-height: 110px; 69 | font-weight: bold; 70 | 71 | } 72 | 73 | .head .userName a{ 74 | color: #fff; 75 | width: 100%; 76 | height: 100%; 77 | display: block; 78 | } 79 | 80 | .head .userName a:hover{ 81 | text-decoration:underline; 82 | } 83 | 84 | /*body 开始*/ 85 | 86 | .body{ 87 | 88 | clear: both; 89 | overflow: hidden; 90 | float: left; 91 | top: 0; 92 | width: 100%; 93 | height: 1000px; 94 | background-color: #F0EEF5; 95 | position: relative; 96 | z-index:-3; 97 | } 98 | 99 | .body .content{ 100 | width: 90%; 101 | height: 100%; 102 | float: left; 103 | margin-left: 5%; 104 | /* background-color: #169FE6; */ 105 | position: relative; 106 | z-index:-1; 107 | } 108 | 109 | .body .content .left{ 110 | width: 23%; 111 | height: 100%; 112 | float: left; 113 | /* background-color: red; */ 114 | } 115 | .body .content .right{ 116 | width: 77%; 117 | float: left; 118 | height: 100%; 119 | /* background-color: blue; */ 120 | } 121 | 122 | .body .content .left .gongGao{ 123 | margin-top: 20px; 124 | width: 100%; 125 | float: left; 126 | } 127 | .body .content .left .gongGao .title{ 128 | width: 100%; 129 | height: 40px; 130 | text-align: center; 131 | background-color: #169FE6; 132 | color: #fff; 133 | font-size: 20px; 134 | line-height: 40px; 135 | } 136 | .body .content .left .gongGao .context{ 137 | width: 100%; 138 | min-height: 150px; 139 | background-color: #fff; 140 | color: black; 141 | font-size: 16px; 142 | padding:10px; 143 | } 144 | 145 | .body .content .left .gongGao .import{ 146 | height: 150px; 147 | } 148 | 149 | .body .content .left .gongGao .context marquee label{ 150 | font-size:14px; 151 | font-weight:normal; 152 | } 153 | 154 | .body .content .left .gongGao .context a{ 155 | display: block; 156 | margin-top: 5px; 157 | } 158 | 159 | .daohang ul li .dropdown-menu li a{ 160 | color: #fff; 161 | font-size: 14px; 162 | margin-left: -10px; 163 | width:100%; 164 | } 165 | 166 | .foot{ 167 | width:100%; 168 | height:50px; 169 | background-color:#169FE6; 170 | float:left; 171 | } 172 | .foot .lable{ 173 | display: block; 174 | width:100%; 175 | height:100%; 176 | line-height:50px; 177 | text-align:center; 178 | float:left; 179 | color: #fff; 180 | } 181 | 182 | .table thead tr th{ 183 | background-color:#169FE6; 184 | color: #fff; 185 | } 186 | 187 | 188 | -------------------------------------------------------------------------------- /web/books/img/ghz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/web/books/img/ghz.jpg -------------------------------------------------------------------------------- /web/books/img/head_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/web/books/img/head_bg.jpg -------------------------------------------------------------------------------- /web/books/img/login_res_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/web/books/img/login_res_bg.jpg -------------------------------------------------------------------------------- /web/books/img/title-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/web/books/img/title-yellow.png -------------------------------------------------------------------------------- /web/books/img/title-yellow1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/45d67e86c94d4a7def12c5448d27c81909fe9d15/web/books/img/title-yellow1.png -------------------------------------------------------------------------------- /web/books/js/addAdmin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ajax提交添加管理员的信息 3 | * @param {Object} '#addAdmin' 4 | */ 5 | $(function () { 6 | 7 | 8 | $('#addAdmin').click(function () { 9 | 10 | if (!validAddAdmin()) { 11 | return; 12 | } 13 | var postdata = "username=" + $.trim($("#addUsername").val()) + "&name=" + $.trim($("#addName").val()) + "&phone=" + $.trim($("#addPhone").val()); 14 | ajax( 15 | { 16 | method: 'POST', 17 | url: 'admin/adminManageAction_addAdmin.action', 18 | params: postdata, 19 | callback: function (data) { 20 | if (data == 1) { 21 | $("#addModal").modal("hide");//关闭模糊框 22 | showInfo("添加成功"); 23 | 24 | } else if (data == -1) { 25 | $("#addModal").modal("hide");//关闭模糊框 26 | showInfo("该管理员已存在"); 27 | } else { 28 | $("#addModal").modal("hide");//关闭模糊框 29 | showInfo("添加失败"); 30 | } 31 | 32 | } 33 | } 34 | ); 35 | 36 | 37 | }); 38 | 39 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 40 | location.reload(); //刷新当前页面 41 | }); 42 | 43 | 44 | }); 45 | 46 | 47 | function validAddAdmin() { 48 | var flag = true; 49 | 50 | var username = $.trim($("#addUsername").val()); 51 | if (username == "") { 52 | $('#addUsername').parent().addClass("has-error"); 53 | $('#addUsername').next().text("请输入用户名"); 54 | $("#addUsername").next().show(); 55 | flag = false; 56 | } else if (username.length < 2 || username.length > 15) { 57 | $("#addUsername").parent().addClass("has-error"); 58 | $("#addUsername").next().text("用户名长度必须在2~15之间"); 59 | $("#addUsername").next().show(); 60 | flag = false; 61 | } else { 62 | $('#addUsername').parent().removeClass("has-error"); 63 | $('#addUsername').next().text(""); 64 | $("#addUsername").next().hide(); 65 | } 66 | 67 | 68 | var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g"); 69 | var name = $.trim($("#addName").val()); 70 | if (name == "") { 71 | $('#addName').parent().addClass("has-error"); 72 | $('#addName').next().text("请输入真实姓名"); 73 | $("#addName").next().show(); 74 | flag = false; 75 | } else if (!reg.test(name)) { 76 | $('#addName').parent().addClass("has-error"); 77 | $('#addName').next().text("真实姓名必须为中文"); 78 | $("#addName").next().show(); 79 | flag = false; 80 | } else { 81 | $('#addName').parent().removeClass("has-error"); 82 | $('#addName').next().text(""); 83 | $("#addName").next().hide(); 84 | } 85 | 86 | var phone = $.trim($("#addPhone").val()); 87 | if (phone == "") { 88 | $('#addPhone').parent().addClass("has-error"); 89 | $('#addPhone').next().text("请输入联系号码"); 90 | $("#addPhone").next().show(); 91 | flag = false; 92 | } else if (!(/^1[34578]\d{9}$/.test(phone))) { 93 | //电话号码格式的校验 94 | $('#addPhone').parent().addClass("has-error"); 95 | $('#addPhone').next().text("手机号码有误"); 96 | $("#addPhone").next().show(); 97 | return false; 98 | } else { 99 | $('#addPhone').parent().removeClass("has-error"); 100 | $('#addPhone').next().text(""); 101 | $("#addPhone").next().hide(); 102 | } 103 | 104 | 105 | return flag; 106 | } 107 | 108 | 109 | function showInfo(msg) { 110 | $("#div_info").text(msg); 111 | $("#modal_info").modal('show'); 112 | } 113 | 114 | 115 | -------------------------------------------------------------------------------- /web/books/js/addBook.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#addBook').click(function () { 5 | 6 | 7 | if (!validAddBook()) { 8 | return; 9 | } 10 | 11 | var postdata = "bookName=" + $.trim($("#addBookName").val()) + "&autho=" + $.trim($("#addAutho").val()) + "&press=" + $.trim($("#addPress").val()) + "&num=" + $.trim($("#addNum").val()) + "&price=" + $.trim($("#addPrice").val()) + "&description=" 12 | + $.trim($("#addDescription").val()) + "&bookTypeId=" + $.trim($("#addBookType").val()) + "&ISBN=" + $.trim($("#addISBN").val()); 13 | 14 | ajax( 15 | { 16 | method: 'POST', 17 | url: 'admin/bookManageAction_addBook.action', 18 | params: postdata, 19 | callback: function (data) { 20 | if (data == 1) { 21 | $("#addModal").modal("hide");//关闭模糊框 22 | showInfo("添加成功"); 23 | 24 | } else { 25 | $("#addModal").modal("hide");//关闭模糊框 26 | showInfo("添加失败"); 27 | } 28 | 29 | } 30 | } 31 | ); 32 | 33 | 34 | }); 35 | 36 | 37 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 38 | location.reload(); //刷新当前页面 39 | }); 40 | 41 | 42 | $('#btn_add').click(function () { 43 | $("#addBookType option[value!=-1]").remove();//移除先前的选项 44 | ajax( 45 | { 46 | url: "admin/bookManageAction_getAllBookTypes.action", 47 | type: "json", 48 | callback: function (data) { 49 | // 循环遍历每个图书分类,每个名称生成一个option对象,添加到中 8 | for (var index in data) { 9 | var op = document.createElement("option");//创建一个指名名称元素 10 | op.value = data[index].readerTypeId;//设置op的实际值为当前的读者分类编号 11 | var textNode = document.createTextNode(data[index].readerTypeName);//创建文本节点 12 | op.appendChild(textNode);//把文本子节点添加到op元素中,指定其显示值 13 | 14 | document.getElementById("addreaderType").appendChild(op); 15 | } 16 | } 17 | } 18 | ); 19 | }; 20 | /** 21 | * ajax提交添加读者的信息 22 | * @param {Object} '#addReader' 23 | */ 24 | $(function () { 25 | 26 | 27 | $('#addReader').click(function () { 28 | 29 | if (!validAddReader()) { 30 | return; 31 | } 32 | 33 | var postdata = "paperNO=" + $.trim($("#addPaperNO").val()) + "&name=" + $.trim($("#addName").val()) + "&phone=" + $.trim($("#addPhone").val()) + "&readerType=" + $.trim($("#addreaderType").val()) 34 | + "&email=" + $.trim($("#addEmail").val()); 35 | ajax( 36 | { 37 | method: 'POST', 38 | url: 'admin/readerManageAction_addReader.action', 39 | params: postdata, 40 | callback: function (data) { 41 | if (data == 1) { 42 | $("#addModal").modal("hide");//关闭模糊框 43 | showInfo("添加成功"); 44 | 45 | } else if (data == -1) { 46 | $("#addModal").modal("hide");//关闭模糊框 47 | showInfo("该读者已存在"); 48 | } else { 49 | $("#addModal").modal("hide");//关闭模糊框 50 | showInfo("添加失败"); 51 | } 52 | 53 | } 54 | } 55 | ); 56 | 57 | 58 | }); 59 | 60 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 61 | location.reload(); //刷新当前页面 62 | }); 63 | 64 | 65 | }); 66 | 67 | 68 | function validAddReader() { 69 | var flag = true; 70 | 71 | var paperNO = $.trim($("#addPaperNO").val()); 72 | if (paperNO == "") { 73 | $('#addPaperNO').parent().addClass("has-error"); 74 | $('#addPaperNO').next().text("请输入读者证件号"); 75 | $("#addPaperNO").next().show(); 76 | flag = false; 77 | } else { 78 | $('#addPaperNO').parent().removeClass("has-error"); 79 | $('#addPaperNO').next().text(""); 80 | $("#addPaperNO").next().hide(); 81 | } 82 | 83 | 84 | var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g"); 85 | var name = $.trim($("#addName").val()); 86 | if (name == "") { 87 | $('#addName').parent().addClass("has-error"); 88 | $('#addName').next().text("请输入真实姓名"); 89 | $("#addName").next().show(); 90 | flag = false; 91 | } else if (!reg.test(name)) { 92 | $('#addName').parent().addClass("has-error"); 93 | $('#addName').next().text("真实姓名必须为中文"); 94 | $("#addName").next().show(); 95 | flag = false; 96 | } else { 97 | $('#addName').parent().removeClass("has-error"); 98 | $('#addName').next().text(""); 99 | $("#addName").next().hide(); 100 | } 101 | 102 | var phone = $.trim($("#addPhone").val()); 103 | if (phone == "") { 104 | $('#addPhone').parent().addClass("has-error"); 105 | $('#addPhone').next().text("请输入联系号码"); 106 | $("#addPhone").next().show(); 107 | flag = false; 108 | } else if (!(/^1[34578]\d{9}$/.test(phone))) { 109 | //电话号码格式的校验 110 | $('#addPhone').parent().addClass("has-error"); 111 | $('#addPhone').next().text("手机号码有误"); 112 | $("#addPhone").next().show(); 113 | return false; 114 | } else { 115 | $('#addPhone').parent().removeClass("has-error"); 116 | $('#addPhone').next().text(""); 117 | $("#addPhone").next().hide(); 118 | } 119 | 120 | var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/; 121 | var email = $.trim($("#addEmail").val()); 122 | if (email == "") { 123 | $('#addEmail').parent().addClass("has-error"); 124 | $('#addEmail').next().text("请输入邮箱"); 125 | $("#addEmail").next().show(); 126 | flag = false; 127 | } else if (!reg.test(email)) { 128 | //邮箱格式的校验 129 | $('#addEmail').parent().addClass("has-error"); 130 | $('#addEmail').next().text("邮箱格式有误"); 131 | $("#addEmail").next().show(); 132 | return false; 133 | } else { 134 | $('#addEmail').parent().removeClass("has-error"); 135 | $('#addEmail').next().text(""); 136 | $("#addEmail").next().hide(); 137 | } 138 | 139 | 140 | var readerType = $.trim($("#addreaderType").val()); 141 | if (readerType == -1) { 142 | $('#addreaderType').parent().addClass("has-error"); 143 | $('#addreaderType').next().text("请选择读者类型"); 144 | $("#addreaderType").next().show(); 145 | flag = false; 146 | } else { 147 | $('#addreaderType').parent().removeClass("has-error"); 148 | $('#addreaderType').next().text(""); 149 | $("#addreaderType").next().hide(); 150 | } 151 | 152 | return flag; 153 | } 154 | 155 | 156 | function showInfo(msg) { 157 | $("#div_info").text(msg); 158 | $("#modal_info").modal('show'); 159 | } 160 | 161 | 162 | -------------------------------------------------------------------------------- /web/books/js/addReaderType.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#addReaderType').click(function () { 5 | 6 | 7 | if (!validAddReaderType()) { 8 | return; 9 | } 10 | 11 | var postdata = "readerTypeName=" + $.trim($("#addType").val()) + "&maxNum=" + $.trim($("#addMaxNum").val()) + "&bday=" + $.trim($("#addBday").val()) 12 | + "&penalty=" + $.trim($("#addPenalty").val()) + "&renewDays=" + $.trim($("#addrenewDays").val()); 13 | ajax( 14 | { 15 | method: 'POST', 16 | url: 'admin/readerTypeManageAction_addReaderType.action', 17 | params: postdata, 18 | callback: function (data) { 19 | if (data == 1) { 20 | $("#addModal").modal("hide");//关闭模糊框 21 | showInfo("添加成功"); 22 | 23 | } else { 24 | $("#addModal").modal("hide");//关闭模糊框 25 | showInfo("添加失败"); 26 | } 27 | 28 | } 29 | } 30 | ); 31 | 32 | 33 | }); 34 | 35 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 36 | location.reload(); //刷新当前页面 37 | }); 38 | 39 | 40 | }); 41 | 42 | 43 | function validAddReaderType() { 44 | var flag = true; 45 | 46 | 47 | var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g"); 48 | var typeName = $.trim($("#addType").val()); 49 | if (typeName == "") { 50 | $('#addType').parent().addClass("has-error"); 51 | $('#addType').next().text("请输入读者类型名称"); 52 | $("#addType").next().show(); 53 | flag = false; 54 | } else if (!reg.test(typeName)) { 55 | $('#addType').parent().addClass("has-error"); 56 | $('#addType').next().text("读者类型名称必须为中文"); 57 | $("#addType").next().show(); 58 | flag = false; 59 | } else { 60 | $('#addType').parent().removeClass("has-error"); 61 | $('#addType').next().text(""); 62 | $("#addType").next().hide(); 63 | } 64 | 65 | var maxNum = $.trim($("#addMaxNum").val()); 66 | if (maxNum == "") { 67 | $('#addMaxNum').parent().addClass("has-error"); 68 | $('#addMaxNum').next().text("请输入最大借阅数量"); 69 | $("#addMaxNum").next().show(); 70 | flag = false; 71 | } else if (maxNum <= 0 || maxNum != parseInt(maxNum)) { 72 | $('#addMaxNum').parent().addClass("has-error"); 73 | $('#addMaxNum').next().text("最大借阅数量必须为正整数"); 74 | $("#addMaxNum").next().show(); 75 | flag = false; 76 | } else { 77 | $('#addMaxNum').parent().removeClass("has-error"); 78 | $('#addMaxNum').next().text(""); 79 | $("#addMaxNum").next().hide(); 80 | } 81 | 82 | 83 | var bday = $.trim($("#addBday").val()); 84 | if (bday == "") { 85 | $('#addBday').parent().addClass("has-error"); 86 | $('#addBday').next().text("请输入最大借阅天数"); 87 | $("#addBday").next().show(); 88 | flag = false; 89 | } else if (bday <= 0 || bday != parseInt(bday)) { 90 | $('#addBday').parent().addClass("has-error"); 91 | $('#addBday').next().text("最大借阅天数必须为正整数"); 92 | $("#addBday").next().show(); 93 | flag = false; 94 | } else { 95 | $('#addBday').parent().removeClass("has-error"); 96 | $('#addBday').next().text(""); 97 | $("#addBday").next().hide(); 98 | } 99 | 100 | 101 | var penalty = $.trim($("#addPenalty").val()); 102 | if (penalty == "") { 103 | $('#addPenalty').parent().addClass("has-error"); 104 | $('#addPenalty').next().text("请输入逾期每日罚金"); 105 | $("#addPenalty").next().show(); 106 | flag = false; 107 | } else if (penalty <= 0 || penalty != parseInt(penalty)) { 108 | $('#addPenalty').parent().addClass("has-error"); 109 | $('#addPenalty').next().text("逾期每日罚金必须为正整数"); 110 | $("#addPenalty").next().show(); 111 | flag = false; 112 | } else { 113 | $('#addPenalty').parent().removeClass("has-error"); 114 | $('#addPenalty').next().text(""); 115 | $("#addPenalty").next().hide(); 116 | } 117 | 118 | 119 | var renewDays = $.trim($("#addrenewDays").val()); 120 | if (renewDays == "") { 121 | $('#addrenewDays').parent().addClass("has-error"); 122 | $('#addrenewDays').next().text("请输入续借天数"); 123 | $("#addrenewDays").next().show(); 124 | flag = false; 125 | } else if (renewDays <= 0 || renewDays != parseInt(renewDays)) { 126 | $('#addrenewDays').parent().addClass("has-error"); 127 | $('#addrenewDays').next().text("续借天数必须为正整数"); 128 | $("#addrenewDays").next().show(); 129 | flag = false; 130 | } else { 131 | $('#addrenewDays').parent().removeClass("has-error"); 132 | $('#addrenewDays').next().text(""); 133 | $("#addrenewDays").next().hide(); 134 | } 135 | 136 | 137 | return flag; 138 | } 139 | 140 | 141 | function showInfo(msg) { 142 | $("#div_info").text(msg); 143 | $("#modal_info").modal('show'); 144 | } 145 | 146 | 147 | -------------------------------------------------------------------------------- /web/books/js/adminLogin.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#login_submit').click(function () { 5 | if (!validLogin()) { 6 | return; 7 | } 8 | 9 | 10 | var postdata = "username=" + $.trim($("#username").val()) + "&pwd=" + $.trim($("#password").val()); 11 | ajax( 12 | { 13 | method: 'POST', 14 | url: 'adminLoginAction_login.action', 15 | params: postdata, 16 | callback: function (data) { 17 | if (data == 1) { 18 | //管理员 19 | window.location.href = "admin/admin.jsp"; 20 | } else if (data == -1) { 21 | showInfo("账号不存在"); 22 | } else if (data == -2) { 23 | showInfo("密码错误"); 24 | } else { 25 | showInfo("登录失败,请重试"); 26 | } 27 | 28 | } 29 | } 30 | ); 31 | 32 | 33 | }); 34 | 35 | 36 | var alert = $('.alert'); 37 | var formWidth = $('.bootstrap-admin-login-form').innerWidth(); 38 | var alertPadding = parseInt($('.alert').css('padding')); 39 | if (isNaN(alertPadding)) { 40 | alertPadding = parseInt($(alert).css('padding-left')); 41 | } 42 | $('.alert').width(formWidth - 2 * alertPadding); 43 | 44 | }); 45 | 46 | function validLogin() { 47 | var flag = true; 48 | 49 | var username = $.trim($("#username").val()); 50 | if (username == "") { 51 | $('#username').parent().addClass("has-error"); 52 | $('#username').next().text("请输入账号"); 53 | $("#username").next().show(); 54 | flag = false; 55 | } else if (username.length < 2 || username.length > 15) { 56 | $("#username").parent().addClass("has-error"); 57 | $("#username").next().text("账号长度必须在2~15之间"); 58 | $("#username").next().show(); 59 | flag = false; 60 | } else { 61 | $('#username').parent().removeClass("has-error"); 62 | $('#username').next().text(""); 63 | $("#username").next().hide(); 64 | } 65 | 66 | var password = $.trim($("#password").val()); 67 | if (password == "") { 68 | $('#password').parent().addClass("has-error"); 69 | $('#password').next().text("请输入密码"); 70 | $("#password").next().show(); 71 | flag = false; 72 | } else if (password.length < 3 || password.length > 15) { 73 | $("#password").parent().addClass("has-error"); 74 | $("#password").next().text("密码长度必须在3~15之间"); 75 | $("#password").next().show(); 76 | flag = false; 77 | } else { 78 | $('#password').parent().removeClass("has-error"); 79 | $('#password').next().text(""); 80 | $("#password").next().hide(); 81 | } 82 | return flag; 83 | } 84 | 85 | function showInfo(msg) { 86 | $("#div_info").text(msg); 87 | $("#modal_info").modal('show'); 88 | } -------------------------------------------------------------------------------- /web/books/js/adminUpdateInfo.js: -------------------------------------------------------------------------------- 1 | /** 2 | *管理员点击个人资料修改按钮触发进行ajax异步请求 3 | * @param {Object} '#admin_updateInfo' 4 | */ 5 | 6 | $(function () { 7 | 8 | 9 | $('#admin_updateInfo').click(function () { 10 | 11 | 12 | if (!validUpdateAdminInfo()) { 13 | return; 14 | } 15 | 16 | var postdata = "username=" + $.trim($("#username").val()) + "&name=" + $.trim($("#name").val()) + "&phone=" + $.trim($("#phone").val()); 17 | ajax( 18 | { 19 | method: 'POST', 20 | url: 'admin/adminInfoAction_adminInfo.action', 21 | params: postdata, 22 | callback: function (data) { 23 | if (data == 1) { 24 | $("#updateinfo").modal("hide");//关闭模糊框 25 | showInfo("修改成功"); 26 | 27 | } else { 28 | $("#updateinfo").modal("hide");//关闭模糊框 29 | showInfo("修改失败"); 30 | } 31 | 32 | } 33 | } 34 | ); 35 | 36 | 37 | }); 38 | 39 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 40 | location.reload(); //刷新当前页面 41 | }); 42 | 43 | 44 | }); 45 | 46 | 47 | function validUpdateAdminInfo() { 48 | var flag = true; 49 | 50 | var username = $.trim($("#username").val()); 51 | if (username == "") { 52 | $('#username').parent().addClass("has-error"); 53 | $('#username').next().text("请输入用户名"); 54 | $("#username").next().show(); 55 | flag = false; 56 | } else if (username.length < 2 || username.length > 15) { 57 | $("#username").parent().addClass("has-error"); 58 | $("#username").next().text("用户名长度必须在2~15之间"); 59 | $("#username").next().show(); 60 | flag = false; 61 | } else { 62 | $('#username').parent().removeClass("has-error"); 63 | $('#username').next().text(""); 64 | $("#username").next().hide(); 65 | } 66 | 67 | 68 | var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g"); 69 | var name = $.trim($("#name").val()); 70 | if (name == "") { 71 | $('#name').parent().addClass("has-error"); 72 | $('#name').next().text("请输入真实姓名"); 73 | $("#name").next().show(); 74 | flag = false; 75 | } else if (!reg.test(name)) { 76 | $('#name').parent().addClass("has-error"); 77 | $('#name').next().text("真实姓名必须为中文"); 78 | $("#name").next().show(); 79 | flag = false; 80 | } else { 81 | $('#name').parent().removeClass("has-error"); 82 | $('#name').next().text(""); 83 | $("#name").next().hide(); 84 | } 85 | 86 | var phone = $.trim($("#phone").val()); 87 | if (phone == "") { 88 | $('#phone').parent().addClass("has-error"); 89 | $('#phone').next().text("请输入联系号码"); 90 | $("#phone").next().show(); 91 | flag = false; 92 | } else if (!(/^1[34578]\d{9}$/.test(phone))) { 93 | //电话号码格式的校验 94 | $('#phone').parent().addClass("has-error"); 95 | $('#phone').next().text("手机号码有误"); 96 | $("#phone").next().show(); 97 | return false; 98 | } else { 99 | $('#phone').parent().removeClass("has-error"); 100 | $('#phone').next().text(""); 101 | $("#phone").next().hide(); 102 | } 103 | 104 | 105 | return flag; 106 | } 107 | 108 | 109 | function showInfo(msg) { 110 | $("#div_info").text(msg); 111 | $("#modal_info").modal('show'); 112 | } -------------------------------------------------------------------------------- /web/books/js/adminUpdatePwd.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 点击修改按钮之后ajax提交数据修改密码 3 | * @param {Object} '#update_adminPwd' 4 | */ 5 | $(function () { 6 | 7 | 8 | $('#update_adminPwd').click(function () { 9 | 10 | 11 | if (!validUpdateAdminPwd()) { 12 | return; 13 | } 14 | 15 | var postdata = "oldPwd=" + $.trim($("#oldPwd").val()) + "&newPwd=" + $.trim($("#newPwd").val()) + "&confirmPwd=" + $.trim($("#confirmPwd").val()); 16 | ajax( 17 | { 18 | method: 'POST', 19 | url: 'admin/adminInfoAction_adminPwd.action', 20 | params: postdata, 21 | callback: function (data) { 22 | if (data == 1) { 23 | $("#updatepwd").modal("hide");//关闭模糊框 24 | showInfo("修改成功"); 25 | 26 | 27 | } else if (data == 0) { 28 | showInfo("确认密码不一致"); 29 | } else if (data == -1) { 30 | showInfo("原密码错误"); 31 | } else { 32 | showInfo("修改失败"); 33 | } 34 | 35 | 36 | } 37 | } 38 | ); 39 | 40 | 41 | }); 42 | 43 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 44 | location.reload(); //刷新当前页面 45 | }); 46 | 47 | 48 | }); 49 | 50 | 51 | function validUpdateAdminPwd() { 52 | var flag = true; 53 | 54 | 55 | var oldPwd = $.trim($("#oldPwd").val()); 56 | if (oldPwd == "") { 57 | $('#oldPwd').parent().addClass("has-error"); 58 | $('#oldPwd').next().text("请输入密码"); 59 | $("#oldPwd").next().show(); 60 | flag = false; 61 | } else if (oldPwd.length < 3 || oldPwd.length > 15) { 62 | $("#oldPwd").parent().addClass("has-error"); 63 | $("#oldPwd").next().text("密码长度必须在3~15之间"); 64 | $("#oldPwd").next().show(); 65 | flag = false; 66 | } else { 67 | $('#oldPwd').parent().removeClass("has-error"); 68 | $('#oldPwd').next().text(""); 69 | $("#oldPwd").next().hide(); 70 | } 71 | 72 | 73 | var newPwd = $.trim($("#newPwd").val()); 74 | if (newPwd == "") { 75 | $('#newPwd').parent().addClass("has-error"); 76 | $('#newPwd').next().text("请输入新密码"); 77 | $("#newPwd").next().show(); 78 | flag = false; 79 | } else if (newPwd.length < 3 || newPwd.length > 15) { 80 | $("#newPwd").parent().addClass("has-error"); 81 | $("#newPwd").next().text("新密码长度必须在3~15之间"); 82 | $("#newPwd").next().show(); 83 | flag = false; 84 | } else { 85 | $('#newPwd').parent().removeClass("has-error"); 86 | $('#newPwd').next().text(""); 87 | $("#newPwd").next().hide(); 88 | } 89 | 90 | 91 | var confirmPwd = $.trim($("#confirmPwd").val()); 92 | if (confirmPwd == "") { 93 | $('#confirmPwd').parent().addClass("has-error"); 94 | $('#confirmPwd').next().text("请输入密码"); 95 | $("#confirmPwd").next().show(); 96 | flag = false; 97 | } else if (confirmPwd.length < 3 || confirmPwd.length > 15) { 98 | $("#confirmPwd").parent().addClass("has-error"); 99 | $("#confirmPwd").next().text("密码长度必须在3~15之间"); 100 | $("#confirmPwd").next().show(); 101 | flag = false; 102 | } else if (confirmPwd != newPwd) { 103 | $("#confirmPwd").parent().addClass("has-error"); 104 | $("#confirmPwd").next().text("确认密码不一致"); 105 | $("#confirmPwd").next().show(); 106 | flag = false; 107 | } else { 108 | $('#confirmPwd').parent().removeClass("has-error"); 109 | $('#confirmPwd').next().text(""); 110 | $("#confirmPwd").next().hide(); 111 | } 112 | 113 | 114 | return flag; 115 | } 116 | 117 | 118 | function showInfo(msg) { 119 | $("#div_info").text(msg); 120 | $("#modal_info").modal('show'); 121 | } -------------------------------------------------------------------------------- /web/books/js/ajax_upload.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | //解决file的change事件只能执行一次的问题 3 | $(document).on('change', '#upload', function () { 4 | ajaxFileUpload(); 5 | }); 6 | }); 7 | 8 | //上传图片的方法, 9 | function ajaxFileUpload() { 10 | //获得basePath 11 | basePath = $('#basePath').val(); 12 | //调用ajaxfileupload.js中的方法 13 | $.ajaxFileUpload({ 14 | url: 'admin/fileUploadAction_fileUpload.action',//上传要提交到的action 15 | secureuri: false,//是否用安全提交,默认为false 16 | fileElementId: 'upload',//file选择文件的框的id 17 | dataType: 'json',//数据返回格式,如果用json,需要修改ajaxfileupload.js中的内容 eval("data = " + data ); -->data = jQuery.parseJSON(jQuery(data).text()); 18 | success: function (data) { 19 | if (data.state == "success") { 20 | $("#excel").val(data.path); 21 | } else { 22 | showInfo("上传的格式有误!!"); 23 | } 24 | } 25 | }); 26 | } 27 | 28 | 29 | function showInfo(msg) { 30 | $("#div_info").text(msg); 31 | $("#modal_info").modal('show'); 32 | } 33 | -------------------------------------------------------------------------------- /web/books/js/backBook.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 5 | location.reload(); //刷新当前页面 6 | }); 7 | 8 | 9 | }); 10 | 11 | 12 | function backBook(id) { 13 | var postdata = "borrowId=" + id; 14 | ajax( 15 | { 16 | method: 'POST', 17 | url: 'admin/backManageAction_backBook.action', 18 | params: postdata, 19 | callback: function (data) { 20 | if (data == 1) { 21 | showInfo("还书成功"); 22 | 23 | } else if (data == -1) { 24 | showInfo("该书已经还了"); 25 | } else if (data == 2) { 26 | showInfo("还书成功,请缴纳逾期罚金"); 27 | } else { 28 | showInfo("还书失败"); 29 | } 30 | 31 | } 32 | } 33 | ); 34 | 35 | 36 | } 37 | 38 | 39 | function showInfo(msg) { 40 | $("#div_info").text(msg); 41 | $("#modal_info").modal('show'); 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /web/books/js/batchAddBook.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#batchAdd').click(function () { 5 | 6 | if (!validBatchAddReader()) { 7 | return; 8 | } 9 | var postdata = "fileName=" + $.trim($("#excel").val()); 10 | ajax( 11 | { 12 | method: 'POST', 13 | url: 'admin/bookManageAction_batchAddBook.action', 14 | type: "json", 15 | params: postdata, 16 | callback: function (data) { 17 | if (data.state == 2) { 18 | //获得basePath 19 | basePath = $('#basePath').val(); 20 | $("#batchAddModal").modal("hide");//关闭模糊框 21 | showInfo(data.message + ",未成功的数据:点击下载"); 22 | 23 | } else if (data.state == 1) { 24 | $("#batchAddModal").modal("hide");//关闭模糊框 25 | showInfo(data.message); 26 | } else if (data.state == -1) { 27 | $("#batchAddModal").modal("hide");//关闭模糊框 28 | showInfo(data.error); 29 | } else { 30 | $("#batchAddModal").modal("hide");//关闭模糊框 31 | showInfo("失败,请重试"); 32 | } 33 | 34 | } 35 | } 36 | ); 37 | 38 | 39 | }); 40 | 41 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 42 | location.reload(); //刷新当前页面 43 | }); 44 | 45 | 46 | }); 47 | 48 | 49 | function validBatchAddReader() { 50 | var flag = true; 51 | var upload = $.trim($("#upload").val()); 52 | if (upload == "") { 53 | alert("请选择excel文件"); 54 | flag = false; 55 | } 56 | 57 | 58 | return flag; 59 | } 60 | 61 | 62 | function checkFileExt(filename) { 63 | var flag = false; //状态 64 | var arr = ["xls"]; 65 | //取出上传文件的扩展名 66 | var index = filename.lastIndexOf("."); 67 | var ext = filename.substr(index + 1); 68 | //循环比较 69 | for (var i = 0; i < arr.length; i++) { 70 | if (ext == arr[i]) { 71 | flag = true; //一旦找到合适的,立即退出循环 72 | break; 73 | } 74 | } 75 | return flag; 76 | } 77 | 78 | 79 | function showInfo(msg) { 80 | $("#div_info").html(msg); 81 | $("#modal_info").modal('show'); 82 | } 83 | 84 | 85 | -------------------------------------------------------------------------------- /web/books/js/batchAddReader.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#batchAdd').click(function () { 5 | 6 | if (!validBatchAddReader()) { 7 | return; 8 | } 9 | var postdata = "fileName=" + $.trim($("#excel").val()); 10 | ajax( 11 | { 12 | method: 'POST', 13 | url: 'admin/readerManageAction_batchAddReader.action', 14 | type: "json", 15 | params: postdata, 16 | callback: function (data) { 17 | if (data.state == 2) { 18 | //获得basePath 19 | basePath = $('#basePath').val(); 20 | $("#batchAddModal").modal("hide");//关闭模糊框 21 | showInfo(data.message + ",未成功的数据:点击下载"); 22 | 23 | } else if (data.state == 1) { 24 | $("#batchAddModal").modal("hide");//关闭模糊框 25 | showInfo(data.message); 26 | } else if (data.state == -1) { 27 | $("#batchAddModal").modal("hide");//关闭模糊框 28 | showInfo(data.error); 29 | } else { 30 | $("#batchAddModal").modal("hide");//关闭模糊框 31 | showInfo("失败,请重试"); 32 | } 33 | 34 | } 35 | } 36 | ); 37 | 38 | 39 | }); 40 | 41 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 42 | location.reload(); //刷新当前页面 43 | }); 44 | 45 | 46 | }); 47 | 48 | 49 | function validBatchAddReader() { 50 | var flag = true; 51 | var upload = $.trim($("#upload").val()); 52 | if (upload == "") { 53 | alert("请选择excel文件"); 54 | flag = false; 55 | } 56 | 57 | 58 | return flag; 59 | } 60 | 61 | 62 | function checkFileExt(filename) { 63 | var flag = false; //状态 64 | var arr = ["xls"]; 65 | //取出上传文件的扩展名 66 | var index = filename.lastIndexOf("."); 67 | var ext = filename.substr(index + 1); 68 | //循环比较 69 | for (var i = 0; i < arr.length; i++) { 70 | if (ext == arr[i]) { 71 | flag = true; //一旦找到合适的,立即退出循环 72 | break; 73 | } 74 | } 75 | return flag; 76 | } 77 | 78 | 79 | function showInfo(msg) { 80 | $("#div_info").html(msg); 81 | $("#modal_info").modal('show'); 82 | } 83 | 84 | 85 | -------------------------------------------------------------------------------- /web/books/js/bootstrap-dropdown.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Project: Twitter Bootstrap Hover Dropdown 3 | * Author: Cameron Spear 4 | * Contributors: Mattia Larentis 5 | * 6 | * Dependencies: Twitter Bootstrap's Dropdown plugin, jQuery 7 | * 8 | * A simple plugin to enable twitter bootstrap dropdowns to active on hover and provide a nice user experience. 9 | * 10 | * License: MIT 11 | * 12 | * http://cameronspear.com/blog/twitter-bootstrap-dropdown-on-hover-plugin/ 13 | */(function(e,t,n){var r=e();e.fn.dropdownHover=function(n){r=r.add(this.parent());return this.each(function(){var i=e(this),s=i.parent(),o={delay:500,instantlyCloseOthers:!0},u={delay:e(this).data("delay"),instantlyCloseOthers:e(this).data("close-others")},a=e.extend(!0,{},o,n,u),f;s.hover(function(e){if(!s.hasClass("open")&&!i.is(e.target))return!0;a.instantlyCloseOthers===!0&&r.removeClass("open");t.clearTimeout(f);s.addClass("open")},function(){f=t.setTimeout(function(){s.removeClass("open")},a.delay)});i.hover(function(){a.instantlyCloseOthers===!0&&r.removeClass("open");t.clearTimeout(f);s.addClass("open")});s.find(".dropdown-submenu").each(function(){var n=e(this),r;n.hover(function(){t.clearTimeout(r);n.children(".dropdown-menu").show();n.siblings().children(".dropdown-menu").hide()},function(){var e=n.children(".dropdown-menu");r=t.setTimeout(function(){e.hide()},a.delay)})})})};e(document).ready(function(){e('[data-hover="dropdown"]').dropdownHover()})})(jQuery,this); -------------------------------------------------------------------------------- /web/books/js/borrowBook.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#btn_borrow').click(function () { 5 | 6 | var postdata = "paperNO=" + $.trim($("#borrowReaderPaperNO").val()) + "&ISBN=" + $.trim($("#borrowBookISBN").val()) + "&pwd=" + $.trim($("#pwd").val()); 7 | ajax( 8 | { 9 | method: 'POST', 10 | url: 'admin/borrowManageAction_borrowBook.action', 11 | params: postdata, 12 | callback: function (data) { 13 | if (data == 1) { 14 | showInfo("借阅成功"); 15 | 16 | } else if (data == -1) { 17 | showInfo("密码错误"); 18 | } else if (data == -2) { 19 | showInfo("借阅数量已达上限"); 20 | 21 | } else if (data == -3) { 22 | showInfo("请先缴纳未缴纳的罚金"); 23 | } else if (data == -4) { 24 | showInfo("该图书为馆内最后一本,无法借阅"); 25 | } else if (data == 2) { 26 | showInfo("读者证件号有误,请重试"); 27 | } else if (data == 3) { 28 | showInfo("图书ISBN号码有误,请重试"); 29 | } else { 30 | showInfo("借阅失败"); 31 | } 32 | } 33 | } 34 | ); 35 | 36 | 37 | }); 38 | 39 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 40 | 41 | location.reload(); //刷新当前页面 42 | }); 43 | 44 | 45 | }); 46 | 47 | 48 | function showInfo(msg) { 49 | $("#div_info").text(msg); 50 | $("#modal_info").modal('show'); 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /web/books/js/dataTables.bootstrap.js: -------------------------------------------------------------------------------- 1 | /*! DataTables Bootstrap 3 integration 2 | * ©2011-2014 SpryMedia Ltd - datatables.net/license 3 | */ 4 | 5 | /** 6 | * DataTables integration for Bootstrap 3. This requires Bootstrap 3 and 7 | * DataTables 1.10 or newer. 8 | * 9 | * This file sets the defaults and adds options to DataTables to style its 10 | * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap 11 | * for further information. 12 | */ 13 | (function (window, document, undefined) { 14 | 15 | var factory = function ($, DataTable) { 16 | "use strict"; 17 | 18 | 19 | /* Set the defaults for DataTables initialisation */ 20 | $.extend(true, DataTable.defaults, { 21 | dom: 22 | "<'row'<'col-sm-6'l><'col-sm-6'f>>" + 23 | "<'row'<'col-sm-12'tr>>" + 24 | "<'row'<'col-sm-5'i><'col-sm-7'p>>", 25 | renderer: 'bootstrap' 26 | }); 27 | 28 | 29 | /* Default class modification */ 30 | $.extend(DataTable.ext.classes, { 31 | sWrapper: "dataTables_wrapper form-inline dt-bootstrap", 32 | sFilterInput: "form-control input-sm", 33 | sLengthSelect: "form-control input-sm" 34 | }); 35 | 36 | 37 | /* Bootstrap paging button renderer */ 38 | DataTable.ext.renderer.pageButton.bootstrap = function (settings, host, idx, buttons, page, pages) { 39 | var api = new DataTable.Api(settings); 40 | var classes = settings.oClasses; 41 | var lang = settings.oLanguage.oPaginate; 42 | var btnDisplay, btnClass, counter = 0; 43 | 44 | var attach = function (container, buttons) { 45 | var i, ien, node, button; 46 | var clickHandler = function (e) { 47 | e.preventDefault(); 48 | if (!$(e.currentTarget).hasClass('disabled')) { 49 | api.page(e.data.action).draw('page'); 50 | } 51 | }; 52 | 53 | for (i = 0, ien = buttons.length; i < ien; i++) { 54 | button = buttons[i]; 55 | 56 | if ($.isArray(button)) { 57 | attach(container, button); 58 | } else { 59 | btnDisplay = ''; 60 | btnClass = ''; 61 | 62 | switch (button) { 63 | case 'ellipsis': 64 | btnDisplay = '…'; 65 | btnClass = 'disabled'; 66 | break; 67 | 68 | case 'first': 69 | btnDisplay = lang.sFirst; 70 | btnClass = button + (page > 0 ? 71 | '' : ' disabled'); 72 | break; 73 | 74 | case 'previous': 75 | btnDisplay = lang.sPrevious; 76 | btnClass = button + (page > 0 ? 77 | '' : ' disabled'); 78 | break; 79 | 80 | case 'next': 81 | btnDisplay = lang.sNext; 82 | btnClass = button + (page < pages - 1 ? 83 | '' : ' disabled'); 84 | break; 85 | 86 | case 'last': 87 | btnDisplay = lang.sLast; 88 | btnClass = button + (page < pages - 1 ? 89 | '' : ' disabled'); 90 | break; 91 | 92 | default: 93 | btnDisplay = button + 1; 94 | btnClass = page === button ? 95 | 'active' : ''; 96 | break; 97 | } 98 | 99 | if (btnDisplay) { 100 | node = $('
  • ', { 101 | 'class': classes.sPageButton + ' ' + btnClass, 102 | 'id': idx === 0 && typeof button === 'string' ? 103 | settings.sTableId + '_' + button : 104 | null 105 | }) 106 | .append($('', { 107 | 'href': '#', 108 | 'aria-controls': settings.sTableId, 109 | 'data-dt-idx': counter, 110 | 'tabindex': settings.iTabIndex 111 | }) 112 | .html(btnDisplay) 113 | ) 114 | .appendTo(container); 115 | 116 | settings.oApi._fnBindAction( 117 | node, {action: button}, clickHandler 118 | ); 119 | 120 | counter++; 121 | } 122 | } 123 | } 124 | }; 125 | 126 | // IE9 throws an 'unknown error' if document.activeElement is used 127 | // inside an iframe or frame. 128 | var activeEl; 129 | 130 | try { 131 | // Because this approach is destroying and recreating the paging 132 | // elements, focus is lost on the select button which is bad for 133 | // accessibility. So we want to restore focus once the draw has 134 | // completed 135 | activeEl = $(host).find(document.activeElement).data('dt-idx'); 136 | } catch (e) { 137 | } 138 | 139 | attach( 140 | $(host).empty().html('
      ').children('ul'), 141 | buttons 142 | ); 143 | 144 | if (activeEl) { 145 | $(host).find('[data-dt-idx=' + activeEl + ']').focus(); 146 | } 147 | }; 148 | 149 | 150 | /* 151 | * TableTools Bootstrap compatibility 152 | * Required TableTools 2.1+ 153 | */ 154 | if (DataTable.TableTools) { 155 | // Set the classes that TableTools uses to something suitable for Bootstrap 156 | $.extend(true, DataTable.TableTools.classes, { 157 | "container": "DTTT btn-group", 158 | "buttons": { 159 | "normal": "btn btn-default", 160 | "disabled": "disabled" 161 | }, 162 | "collection": { 163 | "container": "DTTT_dropdown dropdown-menu", 164 | "buttons": { 165 | "normal": "", 166 | "disabled": "disabled" 167 | } 168 | }, 169 | "print": { 170 | "info": "DTTT_print_info" 171 | }, 172 | "select": { 173 | "row": "active" 174 | } 175 | }); 176 | 177 | // Have the collection use a bootstrap compatible drop down 178 | $.extend(true, DataTable.TableTools.DEFAULTS.oTags, { 179 | "collection": { 180 | "container": "ul", 181 | "button": "li", 182 | "liner": "a" 183 | } 184 | }); 185 | } 186 | 187 | }; // /factory 188 | 189 | 190 | // Define as an AMD module if possible 191 | if (typeof define === 'function' && define.amd) { 192 | define(['jquery', 'datatables'], factory); 193 | } else if (typeof exports === 'object') { 194 | // Node/CommonJS 195 | factory(require('jquery'), require('datatables')); 196 | } else if (jQuery) { 197 | // Otherwise simply initialise as normal, stopping multiple evaluation 198 | factory(jQuery, jQuery.fn.dataTable); 199 | } 200 | 201 | 202 | })(window, document); 203 | 204 | -------------------------------------------------------------------------------- /web/books/js/deleteAdmin.js: -------------------------------------------------------------------------------- 1 | function deleteAdmin(id) { 2 | ajax( 3 | { 4 | method: 'POST', 5 | url: 'admin/adminManageAction_deleteAdmin.action', 6 | params: "id=" + id, 7 | callback: function (data) { 8 | if (data == 1) { 9 | showInfo("删除成功"); 10 | } else { 11 | showInfo("删除失败"); 12 | } 13 | 14 | } 15 | } 16 | ); 17 | 18 | 19 | } 20 | 21 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 22 | location.reload(); //刷新当前页面 23 | }); 24 | 25 | 26 | function showInfo(msg) { 27 | $("#div_info").text(msg); 28 | $("#modal_info").modal('show'); 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /web/books/js/deleteBook.js: -------------------------------------------------------------------------------- 1 | function deleteBook(id) { 2 | ajax( 3 | { 4 | method: 'POST', 5 | url: 'admin/bookManageAction_deleteBook.action', 6 | params: "bookId=" + id, 7 | callback: function (data) { 8 | if (data == 1) { 9 | showInfo("删除成功"); 10 | } else if (data == -1) { 11 | showInfo("该书有未还书记录,不能删除"); 12 | } else if (data == -2) { 13 | showInfo("该书有未缴纳的罚款,不能删除"); 14 | } else { 15 | showInfo("删除失败"); 16 | } 17 | 18 | } 19 | } 20 | ); 21 | 22 | 23 | } 24 | 25 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 26 | location.reload(); //刷新当前页面 27 | }); 28 | 29 | 30 | function showInfo(msg) { 31 | $("#div_info").text(msg); 32 | $("#modal_info").modal('show'); 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /web/books/js/deleteBookType.js: -------------------------------------------------------------------------------- 1 | function deleteBookType(id) { 2 | ajax( 3 | { 4 | method: 'POST', 5 | url: 'admin/bookTypeManageAction_deleteBookType.action', 6 | params: "id=" + id, 7 | callback: function (data) { 8 | if (data == 1) { 9 | showInfo("删除成功"); 10 | } else { 11 | showInfo("删除失败"); 12 | } 13 | 14 | } 15 | } 16 | ); 17 | 18 | 19 | } 20 | 21 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 22 | location.reload(); //刷新当前页面 23 | }); 24 | 25 | 26 | function showInfo(msg) { 27 | $("#div_info").text(msg); 28 | $("#modal_info").modal('show'); 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /web/books/js/deleteReader.js: -------------------------------------------------------------------------------- 1 | function deleteReader(id) { 2 | ajax( 3 | { 4 | method: 'POST', 5 | url: 'admin/readerManageAction_deleteReader.action', 6 | params: "readerId=" + id, 7 | callback: function (data) { 8 | if (data == 1) { 9 | showInfo("删除成功"); 10 | } else if (data == -1) { 11 | showInfo("该读者有未还书记录,不能删除"); 12 | } else if (data == -2) { 13 | showInfo("该读者有未缴纳的罚款,不能删除"); 14 | } else { 15 | showInfo("删除失败"); 16 | } 17 | 18 | } 19 | } 20 | ); 21 | 22 | 23 | } 24 | 25 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 26 | location.reload(); //刷新当前页面 27 | }); 28 | 29 | 30 | function showInfo(msg) { 31 | $("#div_info").text(msg); 32 | $("#modal_info").modal('show'); 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /web/books/js/exportBook.js: -------------------------------------------------------------------------------- 1 | function exportBook() { 2 | //获得basePath 3 | basePath = $('#basePath').val(); 4 | ajax( 5 | { 6 | method: 'GET', 7 | url: 'admin/bookManageAction_exportBook.action', 8 | callback: function (data) { 9 | showInfo("数据已导出:点击下载"); 10 | } 11 | } 12 | ); 13 | 14 | } 15 | 16 | 17 | function showInfo(msg) { 18 | $("#div_info").html(msg); 19 | $("#modal_info").modal('show'); 20 | } 21 | -------------------------------------------------------------------------------- /web/books/js/exportReader.js: -------------------------------------------------------------------------------- 1 | function exportReader() { 2 | //获得basePath 3 | basePath = $('#basePath').val(); 4 | ajax( 5 | { 6 | method: 'GET', 7 | url: 'admin/readerManageAction_exportReader.action', 8 | callback: function (data) { 9 | showInfo("数据已导出:点击下载"); 10 | } 11 | } 12 | ); 13 | 14 | } 15 | 16 | 17 | function showInfo(msg) { 18 | $("#div_info").html(msg); 19 | $("#modal_info").modal('show'); 20 | } 21 | -------------------------------------------------------------------------------- /web/books/js/getAllBookTypes.js: -------------------------------------------------------------------------------- 1 | window.onload = new function () { 2 | ajax( 3 | { 4 | url: "admin/bookManageAction_getAllBookTypes.action", 5 | type: "json", 6 | callback: function (data) { 7 | // 循环遍历每个图书分类,每个名称生成一个option对象,添加到中 8 | for (var index in data) { 9 | var op = document.createElement("option");//创建一个指名名称元素 10 | op.value = data[index].readerTypeId;//设置op的实际值为当前的读者分类编号 11 | var textNode = document.createTextNode(data[index].readerTypeName);//创建文本节点 12 | op.appendChild(textNode);//把文本子节点添加到op元素中,指定其显示值 13 | 14 | document.getElementById("readerType").appendChild(op); 15 | } 16 | } 17 | } 18 | ); 19 | }; -------------------------------------------------------------------------------- /web/books/js/getBackInfo.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 5 | location.reload(); //刷新当前页面 6 | }); 7 | 8 | 9 | }); 10 | 11 | 12 | function getBackInfoById(id) { 13 | ajax( 14 | { 15 | method: 'POST', 16 | url: 'admin/backManageAction_getBackInfoById.action', 17 | params: "borrowId=" + id, 18 | type: "json", 19 | callback: function (data) { 20 | 21 | $("#borrowId").val(data.borrowId); 22 | $("#ISBN").val(data.borrowInfo.book.ISBN); 23 | $("#bookName").val(data.borrowInfo.book.bookName); 24 | $("#bookType").val(data.borrowInfo.book.bookType.typeName); 25 | $("#paperNO").val(data.borrowInfo.reader.paperNO); 26 | $("#readerName").val(data.borrowInfo.reader.name); 27 | $("#readerType").val(data.borrowInfo.reader.readerType.readerTypeName); 28 | $("#overday").val(data.borrowInfo.overday); 29 | if (data.borrowInfo.state == 0) { 30 | $("#state").val("未归还"); 31 | } else if (data.borrowInfo.state == 1) { 32 | $("#state").val("逾期未归还"); 33 | } else if (data.borrowInfo.state == 2) { 34 | $("#state").val("归还"); 35 | } else if (data.borrowInfo.state == 3) { 36 | $("#state").val("续借未归还"); 37 | } else if (data.borrowInfo.state == 4) { 38 | $("#state").val("续借逾期未归还"); 39 | } else if (data.borrowInfo.state == 5) { 40 | $("#state").val("续借归还"); 41 | } 42 | $("#admin").val(data.admin.name); 43 | } 44 | } 45 | ); 46 | 47 | 48 | } 49 | 50 | 51 | function showInfo(msg) { 52 | $("#div_info").text(msg); 53 | $("#modal_info").modal('show'); 54 | } 55 | 56 | 57 | -------------------------------------------------------------------------------- /web/books/js/getBookInfo.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 5 | location.reload(); //刷新当前页面 6 | }); 7 | 8 | 9 | }); 10 | 11 | 12 | function getBookInfo(id) { 13 | 14 | ajax( 15 | { 16 | method: 'POST', 17 | url: 'admin/bookManageAction_getBook.action', 18 | params: "bookId=" + id, 19 | type: "json", 20 | callback: function (data) { 21 | $("#findISBN").val(data.ISBN); 22 | $("#findBookName").val(data.bookName); 23 | $("#findBookType").val(data.bookType.typeName); 24 | $("#findAutho").val(data.autho); 25 | $("#findPress").val(data.press); 26 | $("#findPrice").val(data.price); 27 | $("#findDescription").val(data.description); 28 | $("#findNum").val(data.num); 29 | $("#findAdmin").val(data.admin.name); 30 | $("#findCurrentNum").val(data.currentNum); 31 | } 32 | } 33 | ); 34 | 35 | 36 | } 37 | 38 | 39 | function showInfo(msg) { 40 | $("#div_info").text(msg); 41 | $("#modal_info").modal('show'); 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /web/books/js/getBookTypes.js: -------------------------------------------------------------------------------- 1 | window.onload = new function () { 2 | ajax( 3 | { 4 | url: "bookAction_getAllBookTypes.action", 5 | type: "json", 6 | callback: function (data) { 7 | // 循环遍历每个图书分类,每个名称生成一个option对象,添加到中 53 | for (var index in data) { 54 | var op = document.createElement("option");//创建一个指名名称元素 55 | op.value = data[index].typeId;//设置op的实际值为当前的图书分类编号 56 | var textNode = document.createTextNode(data[index].typeName);//创建文本节点 57 | op.appendChild(textNode);//把文本子节点添加到op元素中,指定其显示值 58 | 59 | document.getElementById("updateBookType").appendChild(op); 60 | } 61 | 62 | ajax( 63 | { 64 | method: 'POST', 65 | url: 'admin/bookManageAction_getBook.action', 66 | params: "bookId=" + id, 67 | type: "json", 68 | callback: function (data) { 69 | $("#updateBookId").val(data.bookId); 70 | $("#updateISBN").val(data.ISBN); 71 | $("#updateBookName").val(data.bookName); 72 | $("#updateBookType").val(data.bookType.typeId); 73 | $("#updateAutho").val(data.autho); 74 | $("#updatePress").val(data.press); 75 | $("#updatePrice").val(data.price); 76 | $("#updateDescription").val(data.description); 77 | 78 | } 79 | } 80 | ); 81 | } 82 | } 83 | ); 84 | 85 | 86 | } 87 | 88 | 89 | function validUpdateBook() { 90 | var flag = true; 91 | 92 | var ISBN = $.trim($("#updateISBN").val()); 93 | if (ISBN == "") { 94 | $('#updateISBN').parent().addClass("has-error"); 95 | $('#updateISBN').next().text("请输入图书ISBN码"); 96 | $("#updateISBN").next().show(); 97 | flag = false; 98 | } else { 99 | $('#updateISBN').parent().removeClass("has-error"); 100 | $('#updateISBN').next().text(""); 101 | $("#updateISBN").next().hide(); 102 | } 103 | 104 | var bookName = $.trim($("#updateBookName").val()); 105 | if (bookName == "") { 106 | $('#updateBookName').parent().addClass("has-error"); 107 | $('#updateBookName').next().text("请输入图书名称"); 108 | $("#updateBookName").next().show(); 109 | flag = false; 110 | } else { 111 | $('#updateBookName').parent().removeClass("has-error"); 112 | $('#updateBookName').next().text(""); 113 | $("#updateBookName").next().hide(); 114 | } 115 | 116 | 117 | var bookType = $.trim($("#updateBookType").val()); 118 | if (bookType == -1) { 119 | $('#updateBookType').parent().addClass("has-error"); 120 | $('#updateBookType').next().text("请选择图书分类"); 121 | $("#updateBookType").next().show(); 122 | flag = false; 123 | } else { 124 | $('#updateBookType').parent().removeClass("has-error"); 125 | $('#updateBookType').next().text(""); 126 | $("#updateBookType").next().hide(); 127 | } 128 | 129 | var autho = $.trim($("#updateAutho").val()); 130 | if (autho == "") { 131 | $('#updateAutho').parent().addClass("has-error"); 132 | $('#updateAutho').next().text("请输入作者名称"); 133 | $("#updateAutho").next().show(); 134 | flag = false; 135 | } else { 136 | $('#updateAutho').parent().removeClass("has-error"); 137 | $('#updateAutho').next().text(""); 138 | $("#updateAutho").next().hide(); 139 | } 140 | 141 | 142 | var press = $.trim($("#updatePress").val()); 143 | if (press == "") { 144 | $('#updatePress').parent().addClass("has-error"); 145 | $('#updatePress').next().text("请输入出版社名称"); 146 | $("#updatePress").next().show(); 147 | flag = false; 148 | } else { 149 | $('#updatePress').parent().removeClass("has-error"); 150 | $('#updatePress').next().text(""); 151 | $("#updatePress").next().hide(); 152 | } 153 | 154 | 155 | var price = $.trim($("#updatePrice").val()); 156 | if (price == "") { 157 | $('#updatePrice').parent().addClass("has-error"); 158 | $('#updatePrice').next().text("请输入总数量"); 159 | $("#updatePrice").next().show(); 160 | flag = false; 161 | } else if (price <= 0 || price != parseInt(price)) { 162 | $('#updatePrice').parent().addClass("has-error"); 163 | $('#updatePrice').next().text("数量必须为正整数"); 164 | $("#updatePrice").next().show(); 165 | flag = false; 166 | } else { 167 | $('#updatePrice').parent().removeClass("has-error"); 168 | $('#updatePrice').next().text(""); 169 | $("#updatePrice").next().hide(); 170 | } 171 | 172 | 173 | return flag; 174 | } 175 | 176 | 177 | function showInfo(msg) { 178 | $("#div_info").text(msg); 179 | $("#modal_info").modal('show'); 180 | } 181 | 182 | 183 | -------------------------------------------------------------------------------- /web/books/js/updateBookType.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ajax提交修改图书分类的信息 3 | * @param {Object} '#updateBookType' 4 | */ 5 | $(function () { 6 | 7 | 8 | $('#updateBookType').click(function () { 9 | 10 | 11 | if (!validUpdateBookType()) { 12 | return; 13 | } 14 | 15 | var postdata = "id=" + $.trim($("#updateBookTypeId").val()) + "&typeName=" + $.trim($("#updateBookTypeName").val()); 16 | ajax( 17 | { 18 | method: 'POST', 19 | url: 'admin/bookTypeManageAction_updateBookType.action', 20 | params: postdata, 21 | callback: function (data) { 22 | if (data == 1) { 23 | $("#updateModal").modal("hide");//关闭模糊框 24 | showInfo("修改成功"); 25 | 26 | } else { 27 | $("#updateinfo").modal("hide");//关闭模糊框 28 | showInfo("修改失败"); 29 | } 30 | 31 | } 32 | } 33 | ); 34 | 35 | 36 | }); 37 | 38 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 39 | location.reload(); //刷新当前页面 40 | }); 41 | 42 | 43 | }); 44 | 45 | 46 | /** 47 | * 获取需要修改图书分类信息 48 | * @param {Object} id 需要修改的图书分类id 49 | */ 50 | function updateBookType(id) { 51 | ajax( 52 | { 53 | method: 'POST', 54 | url: 'admin/bookTypeManageAction_getBookType.action', 55 | params: "id=" + id, 56 | type: "json", 57 | callback: function (data) { 58 | $("#updateBookTypeId").val(data.typeId); 59 | $("#updateBookTypeName").val(data.typeName); 60 | 61 | } 62 | } 63 | ); 64 | 65 | 66 | } 67 | 68 | 69 | function validUpdateBookType() { 70 | var flag = true; 71 | 72 | var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g"); 73 | var bookType = $.trim($("#updateBookTypeName").val()); 74 | if (bookType == "") { 75 | $('#updateBookTypeName').parent().addClass("has-error"); 76 | $('#updateBookTypeName').next().text("请输入图书分类名称"); 77 | $("#updateBookTypeName").next().show(); 78 | flag = false; 79 | } else if (!reg.test(bookType)) { 80 | $('#updateBookTypeName').parent().addClass("has-error"); 81 | $('#updateBookTypeName').next().text("图书分类名称必须为中文"); 82 | $("#updateBookTypeName").next().show(); 83 | flag = false; 84 | } else { 85 | $('#updateBookTypeName').parent().removeClass("has-error"); 86 | $('#updateBookTypeName').next().text(""); 87 | $("#updateBookTypeName").next().hide(); 88 | } 89 | 90 | 91 | return flag; 92 | } 93 | 94 | 95 | function showInfo(msg) { 96 | $("#div_info").text(msg); 97 | $("#modal_info").modal('show'); 98 | } 99 | 100 | 101 | -------------------------------------------------------------------------------- /web/books/js/updateReader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ajax提交修改管理员的信息 3 | * @param {Object} '#updateReader' 4 | */ 5 | $(function () { 6 | 7 | 8 | $('#updateReader').click(function () { 9 | 10 | 11 | if (!validUpdateReader()) { 12 | return; 13 | } 14 | 15 | var postdata = "readerId=" + $.trim($("#updateReaderID").val()) + "&readerType=" + $.trim($("#updateReaderType").val()) 16 | + "&name=" + $.trim($("#updateName").val()) + "&phone=" + $.trim($("#updatePhone").val()) + "&email=" + $.trim($("#updateEmail").val()) 17 | + "&paperNO=" + $.trim($("#updatePaperNO").val()); 18 | ajax( 19 | { 20 | method: 'POST', 21 | url: 'admin/readerManageAction_updateReader.action', 22 | params: postdata, 23 | callback: function (data) { 24 | if (data == 1) { 25 | $("#updateModal").modal("hide");//关闭模糊框 26 | showInfo("修改成功"); 27 | 28 | } else { 29 | $("#updateinfo").modal("hide");//关闭模糊框 30 | showInfo("修改失败"); 31 | } 32 | 33 | } 34 | } 35 | ); 36 | 37 | 38 | }); 39 | 40 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 41 | location.reload(); //刷新当前页面 42 | }); 43 | 44 | 45 | }); 46 | 47 | 48 | /** 49 | * 显示修改前的数据在输入框中 50 | * @param {Object} id 51 | */ 52 | function updateReader(id) { 53 | $("#updateReaderType option[value!=-1]").remove();//移除先前的选项 54 | ajax( 55 | { 56 | url: "admin/readerTypeManageAction_getAllReaderTypes.action", 57 | type: "json", 58 | callback: function (data) { 59 | // 循环遍历每个读者分类,每个名称生成一个option对象,添加到 57 | 58 | 59 |
      60 | 61 | 63 | 64 |
      65 | 66 | 68 |
      69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /web/books/register.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 图书管理系统注册页面 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
      26 | 27 | 76 |
      77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /web/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Administrator 4 | Date: 2021/4/27 0027 5 | Time: 下午 8:39 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | $Title$ 12 | 13 | 14 | $END$ 15 | 16 | 17 | -------------------------------------------------------------------------------- /web/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | 4 | 5 | 6 | 7 | 图书管理系统登录页面 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 34 | 35 | 36 | 37 | 38 | 39 |
      40 |
      41 |
      42 |
      欢 迎 登 录 图 书 管 理 系 统!
      43 | 44 | 72 |
      73 |
      74 |
      75 | 76 | 77 | -------------------------------------------------------------------------------- /web/static/css/admin.css: -------------------------------------------------------------------------------- 1 | /** 2 | * admin.css 3 | */ 4 | 5 | 6 | /* 7 | fixed-layout 固定头部和边栏布局 8 | */ 9 | 10 | html, 11 | body { 12 | height: 100%; 13 | overflow: hidden; 14 | } 15 | 16 | ul { 17 | margin-top: 0; 18 | } 19 | 20 | .admin-icon-yellow { 21 | color: #ffbe40; 22 | } 23 | 24 | .admin-header { 25 | position: fixed; 26 | top: 0; 27 | left: 0; 28 | right: 0; 29 | z-index: 1500; 30 | font-size: 1.4rem; 31 | margin-bottom: 0; 32 | } 33 | 34 | .admin-header-list a:hover :after { 35 | content: none; 36 | } 37 | 38 | .admin-main { 39 | position: relative; 40 | height: 100%; 41 | padding-top: 51px; 42 | background: #f3f3f3; 43 | } 44 | 45 | .admin-menu { 46 | position: fixed; 47 | z-index: 10; 48 | bottom: 30px; 49 | right: 20px; 50 | } 51 | 52 | .admin-sidebar { 53 | width: 260px; 54 | min-height: 100%; 55 | float: left; 56 | border-right: 1px solid #cecece; 57 | } 58 | 59 | .admin-sidebar.am-active { 60 | z-index: 1600; 61 | } 62 | 63 | .admin-sidebar-list { 64 | margin-bottom: 0; 65 | } 66 | 67 | .admin-sidebar-list li a { 68 | color: #5c5c5c; 69 | padding-left: 24px; 70 | } 71 | 72 | .admin-sidebar-list li:first-child { 73 | border-top: none; 74 | } 75 | 76 | .admin-sidebar-sub { 77 | margin-top: 0; 78 | margin-bottom: 0; 79 | box-shadow: 0 16px 8px -15px #e2e2e2 inset; 80 | background: #ececec; 81 | padding-left: 24px; 82 | } 83 | 84 | .admin-sidebar-sub li:first-child { 85 | border-top: 1px solid #dedede; 86 | } 87 | 88 | .admin-sidebar-panel { 89 | margin: 10px; 90 | } 91 | 92 | .admin-content { 93 | display: -webkit-box; 94 | display: -webkit-flex; 95 | display: -ms-flexbox; 96 | display: flex; 97 | -webkit-box-orient: vertical; 98 | -webkit-box-direction: normal; 99 | -webkit-flex-direction: column; 100 | -ms-flex-direction: column; 101 | flex-direction: column; 102 | background: #fff; 103 | } 104 | 105 | .admin-content, 106 | .admin-sidebar { 107 | height: 100%; 108 | overflow-x: hidden; 109 | overflow-y: scroll; 110 | -webkit-overflow-scrolling: touch; 111 | } 112 | 113 | .admin-content-body { 114 | -webkit-box-flex: 1; 115 | -webkit-flex: 1 0 auto; 116 | -ms-flex: 1 0 auto; 117 | flex: 1 0 auto; 118 | } 119 | 120 | .admin-content-footer { 121 | font-size: 85%; 122 | color: #777; 123 | } 124 | 125 | .admin-content-list { 126 | border: 1px solid #e9ecf1; 127 | margin-top: 0; 128 | } 129 | 130 | .admin-content-list li { 131 | border: 1px solid #e9ecf1; 132 | border-width: 0 1px; 133 | margin-left: -1px; 134 | } 135 | 136 | .admin-content-list li:first-child { 137 | border-left: none; 138 | } 139 | 140 | .admin-content-list li:last-child { 141 | border-right: none; 142 | } 143 | 144 | .admin-content-table a { 145 | color: #535353; 146 | } 147 | 148 | .admin-content-file { 149 | margin-bottom: 0; 150 | color: #666; 151 | } 152 | 153 | .admin-content-file p { 154 | margin: 0 0 5px 0; 155 | font-size: 1.4rem; 156 | } 157 | 158 | .admin-content-file li { 159 | padding: 10px 0; 160 | } 161 | 162 | .admin-content-file li:first-child { 163 | border-top: none; 164 | } 165 | 166 | .admin-content-file li:last-child { 167 | border-bottom: none; 168 | } 169 | 170 | .admin-content-file li .am-progress { 171 | margin-bottom: 4px; 172 | } 173 | 174 | .admin-content-file li .am-progress-bar { 175 | line-height: 14px; 176 | } 177 | 178 | .admin-content-task { 179 | margin-bottom: 0; 180 | } 181 | 182 | .admin-content-task li { 183 | padding: 5px 0; 184 | border-color: #eee; 185 | } 186 | 187 | .admin-content-task li:first-child { 188 | border-top: none; 189 | } 190 | 191 | .admin-content-task li:last-child { 192 | border-bottom: none; 193 | } 194 | 195 | .admin-task-meta { 196 | font-size: 1.2rem; 197 | color: #999; 198 | } 199 | 200 | .admin-task-bd { 201 | font-size: 1.4rem; 202 | margin-bottom: 5px; 203 | } 204 | 205 | .admin-content-comment { 206 | margin-bottom: 0; 207 | } 208 | 209 | .admin-content-comment .am-comment-bd { 210 | font-size: 1.4rem; 211 | } 212 | 213 | .admin-content-pagination { 214 | margin-bottom: 0; 215 | } 216 | 217 | .admin-content-pagination li a { 218 | padding: 4px 8px; 219 | } 220 | 221 | @media only screen and (min-width: 641px) { 222 | .admin-sidebar { 223 | display: block; 224 | position: static; 225 | background: none; 226 | } 227 | 228 | .admin-offcanvas-bar { 229 | position: static; 230 | width: auto; 231 | background: none; 232 | -webkit-transform: translate3d(0, 0, 0); 233 | -ms-transform: translate3d(0, 0, 0); 234 | transform: translate3d(0, 0, 0); 235 | overflow-y: visible; 236 | min-height: 100%; 237 | } 238 | 239 | .admin-offcanvas-bar:after { 240 | content: none; 241 | } 242 | } 243 | 244 | @media only screen and (max-width: 640px) { 245 | .admin-sidebar { 246 | width: inherit; 247 | } 248 | 249 | .admin-offcanvas-bar { 250 | background: #f3f3f3; 251 | } 252 | 253 | .admin-offcanvas-bar:after { 254 | background: #BABABA; 255 | } 256 | 257 | .admin-sidebar-list a:hover, .admin-sidebar-list a:active { 258 | -webkit-transition: background-color .3s ease; 259 | -moz-transition: background-color .3s ease; 260 | -ms-transition: background-color .3s ease; 261 | -o-transition: background-color .3s ease; 262 | transition: background-color .3s ease; 263 | background: #E4E4E4; 264 | } 265 | 266 | .admin-content-list li { 267 | padding: 10px; 268 | border-width: 1px 0; 269 | margin-top: -1px; 270 | } 271 | 272 | .admin-content-list li:first-child { 273 | border-top: none; 274 | } 275 | 276 | .admin-content-list li:last-child { 277 | border-bottom: none; 278 | } 279 | 280 | .admin-form-text { 281 | text-align: left !important; 282 | } 283 | 284 | } 285 | 286 | /* 287 | * user.html css 288 | */ 289 | .user-info { 290 | margin-bottom: 15px; 291 | } 292 | 293 | .user-info .am-progress { 294 | margin-bottom: 4px; 295 | } 296 | 297 | .user-info p { 298 | margin: 5px; 299 | } 300 | 301 | .user-info-order { 302 | font-size: 1.4rem; 303 | } 304 | 305 | /* 306 | * errorLog.html css 307 | */ 308 | 309 | .error-log .am-pre-scrollable { 310 | max-height: 40rem; 311 | } 312 | 313 | /* 314 | * table.html css 315 | */ 316 | 317 | .table-main { 318 | font-size: 1.4rem; 319 | padding: .5rem; 320 | } 321 | 322 | .table-main button { 323 | background: #fff; 324 | } 325 | 326 | .table-check { 327 | width: 30px; 328 | } 329 | 330 | .table-id { 331 | width: 50px; 332 | } 333 | 334 | @media only screen and (max-width: 640px) { 335 | .table-select { 336 | margin-top: 10px; 337 | margin-left: 5px; 338 | } 339 | } 340 | 341 | /* 342 | gallery.html css 343 | */ 344 | 345 | .gallery-list li { 346 | padding: 10px; 347 | } 348 | 349 | .gallery-list a { 350 | color: #666; 351 | } 352 | 353 | .gallery-list a:hover { 354 | color: #3bb4f2; 355 | } 356 | 357 | .gallery-title { 358 | margin-top: 6px; 359 | font-size: 1.4rem; 360 | } 361 | 362 | .gallery-desc { 363 | font-size: 1.2rem; 364 | margin-top: 4px; 365 | } 366 | 367 | /* 368 | 404.html css 369 | */ 370 | 371 | .page-404 { 372 | background: #fff; 373 | border: none; 374 | width: 200px; 375 | margin: 0 auto; 376 | } 377 | -------------------------------------------------------------------------------- /web/static/css/fullcalendar.print.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * FullCalendar v0.0.0 Print Stylesheet 3 | * Docs & License: http://fullcalendar.io/ 4 | * (c) 2016 Adam Shaw 5 | */ 6 | 7 | /* 8 | * Include this stylesheet on your page to get a more printer-friendly calendar. 9 | * When including this stylesheet, use the media='print' attribute of the tag. 10 | * Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css. 11 | */ 12 | 13 | .fc { 14 | max-width: 100% !important; 15 | } 16 | 17 | 18 | /* Global Event Restyling 19 | --------------------------------------------------------------------------------------------------*/ 20 | 21 | .fc-event { 22 | background: #fff !important; 23 | color: #000 !important; 24 | page-break-inside: avoid; 25 | } 26 | 27 | .fc-event .fc-resizer { 28 | display: none; 29 | } 30 | 31 | 32 | /* Table & Day-Row Restyling 33 | --------------------------------------------------------------------------------------------------*/ 34 | 35 | .fc th, 36 | .fc td, 37 | .fc hr, 38 | .fc thead, 39 | .fc tbody, 40 | .fc-row { 41 | border-color: #ccc !important; 42 | background: #fff !important; 43 | } 44 | 45 | /* kill the overlaid, absolutely-positioned components */ 46 | /* common... */ 47 | .fc-bg, 48 | .fc-bgevent-skeleton, 49 | .fc-highlight-skeleton, 50 | .fc-helper-skeleton, 51 | /* for timegrid. within cells within table skeletons... */ 52 | .fc-bgevent-container, 53 | .fc-business-container, 54 | .fc-highlight-container, 55 | .fc-helper-container { 56 | display: none; 57 | } 58 | 59 | /* don't force a min-height on rows (for DayGrid) */ 60 | .fc tbody .fc-row { 61 | height: auto !important; /* undo height that JS set in distributeHeight */ 62 | min-height: 0 !important; /* undo the min-height from each view's specific stylesheet */ 63 | } 64 | 65 | .fc tbody .fc-row .fc-content-skeleton { 66 | position: static; /* undo .fc-rigid */ 67 | padding-bottom: 0 !important; /* use a more border-friendly method for this... */ 68 | } 69 | 70 | .fc tbody .fc-row .fc-content-skeleton tbody tr:last-child td { /* only works in newer browsers */ 71 | padding-bottom: 1em; /* ...gives space within the skeleton. also ensures min height in a way */ 72 | } 73 | 74 | .fc tbody .fc-row .fc-content-skeleton table { 75 | /* provides a min-height for the row, but only effective for IE, which exaggerates this value, 76 | making it look more like 3em. for other browers, it will already be this tall */ 77 | height: 1em; 78 | } 79 | 80 | 81 | /* Undo month-view event limiting. Display all events and hide the "more" links 82 | --------------------------------------------------------------------------------------------------*/ 83 | 84 | .fc-more-cell, 85 | .fc-more { 86 | display: none !important; 87 | } 88 | 89 | .fc tr.fc-limited { 90 | display: table-row !important; 91 | } 92 | 93 | .fc td.fc-limited { 94 | display: table-cell !important; 95 | } 96 | 97 | .fc-popover { 98 | display: none; /* never display the "more.." popover in print mode */ 99 | } 100 | 101 | 102 | /* TimeGrid Restyling 103 | --------------------------------------------------------------------------------------------------*/ 104 | 105 | /* undo the min-height 100% trick used to fill the container's height */ 106 | .fc-time-grid { 107 | min-height: 0 !important; 108 | } 109 | 110 | /* don't display the side axis at all ("all-day" and time cells) */ 111 | .fc-agenda-view .fc-axis { 112 | display: none; 113 | } 114 | 115 | /* don't display the horizontal lines */ 116 | .fc-slats, 117 | .fc-time-grid hr { /* this hr is used when height is underused and needs to be filled */ 118 | display: none !important; /* important overrides inline declaration */ 119 | } 120 | 121 | /* let the container that holds the events be naturally positioned and create real height */ 122 | .fc-time-grid .fc-content-skeleton { 123 | position: static; 124 | } 125 | 126 | /* in case there are no events, we still want some height */ 127 | .fc-time-grid .fc-content-skeleton table { 128 | height: 4em; 129 | } 130 | 131 | /* kill the horizontal spacing made by the event container. event margins will be done below */ 132 | .fc-time-grid .fc-event-container { 133 | margin: 0 !important; 134 | } 135 | 136 | 137 | /* TimeGrid *Event* Restyling 138 | --------------------------------------------------------------------------------------------------*/ 139 | 140 | /* naturally position events, vertically stacking them */ 141 | .fc-time-grid .fc-event { 142 | position: static !important; 143 | margin: 3px 2px !important; 144 | } 145 | 146 | /* for events that continue to a future day, give the bottom border back */ 147 | .fc-time-grid .fc-event.fc-not-end { 148 | border-bottom-width: 1px !important; 149 | } 150 | 151 | /* indicate the event continues via "..." text */ 152 | .fc-time-grid .fc-event.fc-not-end:after { 153 | content: "..."; 154 | } 155 | 156 | /* for events that are continuations from previous days, give the top border back */ 157 | .fc-time-grid .fc-event.fc-not-start { 158 | border-top-width: 1px !important; 159 | } 160 | 161 | /* indicate the event is a continuation via "..." text */ 162 | .fc-time-grid .fc-event.fc-not-start:before { 163 | content: "..."; 164 | } 165 | 166 | /* time */ 167 | 168 | /* undo a previous declaration and let the time text span to a second line */ 169 | .fc-time-grid .fc-event .fc-time { 170 | white-space: normal !important; 171 | } 172 | 173 | /* hide the the time that is normally displayed... */ 174 | .fc-time-grid .fc-event .fc-time span { 175 | display: none; 176 | } 177 | 178 | /* ...replace it with a more verbose version (includes AM/PM) stored in an html attribute */ 179 | .fc-time-grid .fc-event .fc-time:after { 180 | content: attr(data-full); 181 | } 182 | 183 | 184 | /* Vertical Scroller & Containers 185 | --------------------------------------------------------------------------------------------------*/ 186 | 187 | /* kill the scrollbars and allow natural height */ 188 | .fc-scroller, 189 | .fc-day-grid-container, /* these divs might be assigned height, which we need to cleared */ 190 | .fc-time-grid-container { /* */ 191 | overflow: visible !important; 192 | height: auto !important; 193 | } 194 | 195 | /* kill the horizontal border/padding used to compensate for scrollbars */ 196 | .fc-row { 197 | border: 0 !important; 198 | margin: 0 !important; 199 | } 200 | 201 | 202 | /* Button Controls 203 | --------------------------------------------------------------------------------------------------*/ 204 | 205 | .fc-button-group, 206 | .fc button { 207 | display: none; /* don't display any button-related controls */ 208 | } 209 | -------------------------------------------------------------------------------- /web/static/js/theme.js: -------------------------------------------------------------------------------- 1 | var saveSelectColor = { 2 | 'Name': 'SelcetColor', 3 | 'Color': 'theme-white' 4 | } 5 | 6 | 7 | // 判断用户是否已有自己选择的模板风格 8 | if (storageLoad('SelcetColor')) { 9 | $('body').attr('class', storageLoad('SelcetColor').Color) 10 | } else { 11 | storageSave(saveSelectColor); 12 | $('body').attr('class', 'theme-white') 13 | } 14 | 15 | 16 | // 本地缓存 17 | function storageSave(objectData) { 18 | localStorage.setItem(objectData.Name, JSON.stringify(objectData)); 19 | } 20 | 21 | function storageLoad(objectName) { 22 | if (localStorage.getItem(objectName)) { 23 | return JSON.parse(localStorage.getItem(objectName)) 24 | } else { 25 | return false 26 | } 27 | } --------------------------------------------------------------------------------