3.3 管理员模块 3.3.1 用户管理
图3-5 用户管理界面
用户管理代码
删除
@RequestMapping("/user_delete")public String user_delete(@RequestParam("id") String id){System.out.println(id);userMapper.deleteUserById(id);userBorrowMapper.deleteUserBorrowByUserId(id);return "redirect:user";}
更新
图3-6 用户更新页面
代码
@RequestMapping("/update_user")public String update_user(User user){System.out.println("update_user:"+user.toString());userMapper.updateUserById(user);return "redirect:user";}
3.3.2 书本管理
书本管理主页
图3-7 书籍管理界面
文章插图
代码
@RequestMapping("/book")public String book(Model model,HttpSession session){Param param = paramMapper.findParamByName("views");if(param!=null){paramMapper.updateParamById(param.getId());}else{paramMapper.addParam(new Param(UUID.randomUUID().toString().replace("-",""),"views",1));}Integer views = paramMapper.findParamByName("views").getNum();List
删除
@RequestMapping("/book_delete")public String book_delete(@RequestParam("id") String id){System.out.println(id);Book book = bookMapper.findBookById(id);Integer booknum = book.getNum();if (booknum>1){bookMapper.updateBookNumById(id);}else{userBorrowMapper.deleteUserBorrowByBookId(id);bookMapper.deleteBookById(id);}return "redirect:book";}
更新
图3-8 书本更新页面
代码
@RequestMapping("/book_update")public String book_update(Book book,Model model){bookMapper.updateBookById(book);return "redirect:book";}
添加
图3-9 书本添加页面
代码
@RequestMapping("/add_book")public String add_book(Book book){book.setId(UUID.randomUUID().toString().replace("-",""));bookMapper.addBook(book);return "redirect:book";}
搜索
图3-10 书籍管理书本搜索结果页面
代码
@RequestMapping("/book_search")public String book_search(String keywords,Model model,HttpSession session){System.out.println("keywords:"+keywords);List
3.4 借阅归还模块 3.4.1 借阅
图3-11 书本详情页面
借阅代码
@RequestMapping("/borrow")public String borrow(@RequestParam("id") String id,Model model,HttpSession session){String uid = (String)session.getAttribute("id");String bid = id;Book book = bookMapper.findBookById(id);UserBorrow userBorrow = userBorrowMapper.findUserBorrowByUidAndBid(uid,id);if (userBorrow==null){String tid = UUID.randomUUID().toString().replace("-","");userBorrow = new UserBorrow(tid,uid,bid,1,new Date(System.currentTimeMillis()),null);userBorrowMapper.addUserBorrow(userBorrow);}else{userBorrowMapper.updateUserBorrowByIdBorrow(userBorrow.getId(),1);}UserBorrow userBorrow1 = userBorrowMapper.findUserBorrowByUidAndBid(uid,bid);model.addAttribute("book",book);model.addAttribute("username",session.getAttribute("username"));model.addAttribute("isBorrow",userBorrow1.getIsValid());return "book_detail";}
- php养老院管理系统 毕业设计源码202026
- 基于Android的电子书阅读器(Android studio毕业设计
- [附源码]Python计算机毕业设计Django软考刷题小程序
- 程序+源码+LW文档 [附源码]计算机毕业设计Python软考刷题小程序
- Thinkphp+Uniapp开发的CRM客户关系管理系统源码
- 大理学院图书馆
- 嘉兴市图书馆
- 优优图书馆
- 晋江图书馆
- 地质图书馆