——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Tomcat≥8
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM+Maven图书馆图书管理系统(java+ssm+jsp+js+mysql)
项目介绍
读者角色包含以下功能: 读者登录,图书查询,借阅图书,借阅管理,修改密码,借阅记录等功能。
管理员角色包含以下功能: 管理员登录,图书管理,图书类别管理,读者列表等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;
技术栈
后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp
使用说明
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
——————————CodeStart——————————
1 2 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 @RequestMapping("/listDisBack") public String listDisBack () { return "listDisBack" ; } @RequestMapping("/listDisBackBook") @ResponseBody public String listDisBackBook (@RequestParam(value = "page", defaultValue = "1") Integer pageno, @RequestParam(value = "limit", defaultValue = "5") Integer pagesize, @RequestParam(value = "power",defaultValue = "0") Integer power, String rname,String bname,String state) { Map<String,Object> paramMap = new HashMap(); paramMap.put("pageno" ,pageno); paramMap.put("pagesize" ,pagesize); if (StringUtil.isNotEmpty(bname)) paramMap.put("bname" ,bname); if (StringUtil.isNotEmpty(rname)) paramMap.put("rname" ,rname); if (StringUtil.isNotEmpty(state)) paramMap.put("state" ,state); if (power.equals(0 )){ } PageBean<LendInfo> pageBean = lendInfoSerivce.queryLeadInfoPage(paramMap); JSONObject obj = new JSONObject(); obj.put("code" , 0 ); obj.put("msg" , "" ); obj.put("count" ,pageBean.getTotalsize()); obj.put("data" , pageBean.getDatas()); return obj.toString(); } @RequestMapping(value = "/backBook") @ResponseBody public AjaxResult backBook (@RequestParam(value = "reader_id" , defaultValue = "1") Integer reader_id, @RequestParam(value = "book_id" , defaultValue = "1") Integer book_id) { AjaxResult ajaxResult = new AjaxResult(); Map<String, Object> ret = new HashMap<String, Object>(); ret.put("reader_id" ,reader_id); ret.put("book_id" ,book_id); try {
1 2 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 @ResponseBody public String listBook (@RequestParam(value = "page", defaultValue = "1") Integer pageno, @RequestParam(value = "limit", defaultValue = "5") Integer pagesize, String bname,String author,String cid,HttpSession session ) { Map<String,Object> paramMap = new HashMap(); paramMap.put("pageno" ,pageno); paramMap.put("pagesize" ,pagesize); if (StringUtil.isNotEmpty(bname)) paramMap.put("bname" ,bname); if (StringUtil.isNotEmpty(author)) paramMap.put("author" ,author); if (StringUtil.isNotEmpty(cid)) paramMap.put("cid" ,Integer.parseInt(cid)); PageBean<Book> pageBean = bookService.queryBookPage(paramMap); List<Category> categoryList = bookService.listCategory(); session.setAttribute(Const.CATEGORY,categoryList); JSONObject obj = new JSONObject(); obj.put("code" , 0 ); obj.put("msg" , "" ); obj.put("count" ,pageBean.getTotalsize()); obj.put("data" , pageBean.getDatas()); return obj.toString(); } @RequestMapping("/addBook") public String addbook () { return "book/addBook" ; } @RequestMapping("/submitAddBook") @ResponseBody public AjaxResult submitAddBook (Book book) { AjaxResult ajaxResult = new AjaxResult();
1 2 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 28 29 30 31 32 33 34 35 36 37 @Controller public class commonController { @Autowired private ReaderService readerService; @Autowired private AdminService adminService; @Autowired private LendInfoSerivce lendInfoSerivce; @RequestMapping("/toLogin") public String login () { return "login" ; } @RequestMapping("/toRegister") public String toRegister () { return "register" ; } @RequestMapping("/checkReader") @ResponseBody public AjaxResult checkreader (Integer reader_id) { AjaxResult ajaxResult = new AjaxResult(); int count=readerService.checkReader(reader_id); if (count==0 ){ ajaxResult.setSuccess(true ); }else { ajaxResult.setSuccess(false ); ajaxResult.setMessage("当前学号已被注册!" ); } return ajaxResult;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 @Controller public class commonController { @Autowired private ReaderService readerService; @Autowired private AdminService adminService; @Autowired private LendInfoSerivce lendInfoSerivce; @RequestMapping("/toLogin") public String login () { return "login" ; } @RequestMapping("/toRegister") public String toRegister () { return "register" ; }
1 2 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 ajaxResult.setSuccess(true ); ajaxResult.setMessage("修改成功" ); }catch (Exception e){ e.printStackTrace(); ajaxResult.setSuccess(false ); ajaxResult.setMessage("修改失败" ); } return ajaxResult; } @RequestMapping("/delBookType") @ResponseBody public AjaxResult delBookType (Integer cid) { AjaxResult ajaxResult = new AjaxResult(); try { typeService.delBookType(cid); ajaxResult.setSuccess(true ); }catch (Exception e){ e.printStackTrace(); ajaxResult.setSuccess(false ); ajaxResult.setMessage("删除失败" ); } return ajaxResult; } @RequestMapping("/addBookType") @ResponseBody public AjaxResult addBookType (String cname) { AjaxResult ajaxResult = new AjaxResult(); try { typeService.addBookType(cname); ajaxResult.setSuccess(true ); }catch (Exception e){ e.printStackTrace(); ajaxResult.setSuccess(false ); ajaxResult.setMessage("添加失败" ); }
1 2 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 try { typeService.updateBookType(category); ajaxResult.setSuccess(true ); ajaxResult.setMessage("修改成功" ); }catch (Exception e){ e.printStackTrace(); ajaxResult.setSuccess(false ); ajaxResult.setMessage("修改失败" ); } return ajaxResult; } @RequestMapping("/delBookType") @ResponseBody public AjaxResult delBookType (Integer cid) { AjaxResult ajaxResult = new AjaxResult(); try { typeService.delBookType(cid); ajaxResult.setSuccess(true ); }catch (Exception e){ e.printStackTrace(); ajaxResult.setSuccess(false ); ajaxResult.setMessage("删除失败" ); } return ajaxResult; } @RequestMapping("/addBookType") @ResponseBody public AjaxResult addBookType (String cname) { AjaxResult ajaxResult = new AjaxResult(); try { typeService.addBookType(cname); ajaxResult.setSuccess(true ); }catch (Exception e){ e.printStackTrace(); ajaxResult.setSuccess(false ); ajaxResult.setMessage("添加失败" ); } return ajaxResult; }
——————————PayStart——————————
项目链接: https://javayms.github.io?id=282322092805200mg https://javayms.pages.dev?id=282322092805200mg