基于javaweb+mysql的图书管理系统(java+SpringBoot+jpa+html+swagger+maven+mysql)

项目介绍
该项目比较界面简单大方,功能简洁,只有三张表,适合java初学者或者课程设计;
主要功能包括:
首页轮播图
图书管理:图书列表、图书上架;
借阅管理:搜索图书、借阅图书、归还图书;
读者管理:读者列表、读者添加;

用户中心:个人信息、用户管理、添加管理员;

环境需要
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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

6.数据库:MySql 5.7版本;

技术栈

  1. 后端:springboot+jpa+mybatis+springsecurity+swagger+

  2. 前端:html+javaex

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
    2.将book-manager导入到开发工具中(idea/eclipse)均可
  • idea:直接open打开源码文件夹,记住是pom文件所在的目录
  • eclipse: 直接导入- 选择已存在导入maven项目
  • 检查maven是否配置好,建议使用阿里云加速,这样等待时间比较短
  1. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
  2. 运行项目,输入localhost:8080 登录
  3. 管理员用户名:admin 密码:123

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

    //注入
    @Autowired
    private LibraryCategoryService libraryCategoryService;
    /**
     * 添加 图书类目
     *
     * @param category 图书类目信息
     * @param session  添加人
     * @return url
     * @author hiseico
     */
    @RequestMapping(value = "/addCategory", method = RequestMethod.POST)
    public String addCategory(TbCategory category, HttpSession session, Model model) {
        List<TbCategory> categoryList = libraryCategoryService.getCategoryAll();
        boolean is = false;
        for (TbCategory tbCategory : categoryList) {
            if (category.getCatname().equals(tbCategory.getCatname())) {
                is = true;
                break;
            }
        }
    @RequestMapping("/toUpdatePage")
    @ResponseBody
    public TbCategory toUpdatePage(int id) {
        return libraryCategoryService.getCategoryById(id);
    }
}
图书操作控制层: 
/**
 * @description: 图书操作
 */
@Controller
@RequestMapping("/admin/ch")
public class LibraryController {
    //注入
    @Autowired
    private LibraryService libraryService;
    /**
        // 获取 session 中的用户信息
        ActiveUser activeUser = (ActiveUser) session.getAttribute("activeUser");
        TbUser tbUser = new TbUser();
        tbUser.setId(activeUser.getUserid());
        order.setUserId(tbUser.getId());
        // 插入数据
        libraryService.jieyueBookById(order);
        return "redirect:/user/ch/bookId.action?id=" + order.getBookId();
    }
    @RequestMapping("/commitInfo")
    @ResponseBody
    public String commitComment(HttpSession session, TbComment comment) {
        // 获取 session 中的用户信息
        ActiveUser activeUser = (ActiveUser) session.getAttribute("activeUser");
        TbUser tbUser = new TbUser();
        tbUser.setId(activeUser.getUserid());
        comment.setUserId(tbUser.getId());
        libraryService.addCommentInfo(comment);
        return "ok";
    }
}
图书类别处理控制层:
/**
 * @description: 图书类别处理
 */
@Controller
@RequestMapping("/admin/ch/category")
/**
 * @description: 图书操作
 */
@Controller
@RequestMapping("/admin/ch")
public class LibraryController {
    //注入
    @Autowired
    private LibraryService libraryService;
    /**
     * 修改图书信息
     *
     * @param uploadFile 上传图片
     * @param library    图书信息
     * @return
     */
    @RequestMapping(value = "/updateBook", method = RequestMethod.POST)
    public String updateBook(MultipartFile uploadFile, TbLibrary library, HttpServletRequest request) {
图书类别处理控制层:
/**
 * @description: 图书类别处理
 */
@Controller
@RequestMapping("/admin/ch/category")
public class CategoryController {
    //注入
    @Autowired
    private LibraryCategoryService libraryCategoryService;
    /**
     * 添加 图书类目
     *
     * @param category 图书类目信息
     * @param session  添加人
     * @return url
     * @author hiseico
     */
    @RequestMapping(value = "/addCategory", method = RequestMethod.POST)
        // 获取当前类目信息
        TbCategory currentCategory = libraryCategoryService.getCategoryById(libraryQuery.getCateId());
        // 按照条件进行查询
        PageCount<TblibraryExt> libraryPageCount = libraryService.findLibraryByAll(libraryQuery, pageCount);
        // model 将数据设置到域中
        model.addAttribute("subCategoryList", categoryList);
        model.addAttribute("libraryPageCount", libraryPageCount);
        // 默认
        if (currentCategory == null) {
            currentCategory = new TbCategory();
            currentCategory.setId(0);
        }
        session.setAttribute("currentCategory", currentCategory.getId());
        return "/user/user_bookList";
    }
    /**
/**
 * @description: 图书类别处理
 */
@Controller
@RequestMapping("/admin/ch/category")
public class CategoryController {
    //注入
    @Autowired
    private LibraryCategoryService libraryCategoryService;
    /**
     * 添加 图书类目
     *
     * @param category 图书类目信息
     * @param session  添加人
     * @return url
     * @author hiseico
     */
        if (null != oid) {
            TbRecord tbOrder = recordMapper.selectByPrimaryKey(Integer.valueOf(oid));
            // 插入数据
            tbOrder.setBackdate(tbOrder.getBackdate() + 3 * 30 * 24 * 60 * 60);
            recordMapper.updateByPrimaryKey(tbOrder);
            model.addAttribute("successMsg", "续借三个月成功");
            return "errorMsg";
        }
        // 获取 session 中的用户信息
        ActiveUser activeUser = (ActiveUser) session.getAttribute("activeUser");
        TbUser tbUser = new TbUser();
        tbUser.setId(activeUser.getUserid());
        order.setUserId(tbUser.getId());
        // 插入数据
        libraryService.jieyueBookById(order);
        return "redirect:/user/ch/bookId.action?id=" + order.getBookId();
    }
    @RequestMapping("/commitInfo")
    @ResponseBody
    public String commitComment(HttpSession session, TbComment comment) {
        // 获取 session 中的用户信息
        ActiveUser activeUser = (ActiveUser) session.getAttribute("activeUser");
        TbUser tbUser = new TbUser();
        tbUser.setId(activeUser.getUserid());
        comment.setUserId(tbUser.getId());
    @Value("${LOGIN_USER}")
    private String LOGIN_USER;  // 当前登录用户的 session 存储 属性名
    @RequestMapping("/user_bookList")
    public String toLibraryListByCid(TbLibraryQuery libraryQuery, PageCount pageCount, Model model, HttpSession session) {
        if (libraryQuery == null || libraryQuery.getCateId() == null) {
            libraryQuery = new TbLibraryQuery();
            libraryQuery.setCateId((Integer) session.getAttribute("currentCategory"));
        }
        // 根据 类目 id
        // 若 当前 类目 为 父类目 则获取 其 下面 的 所有子类目
        // 若 当前 类目 为 子类目 则获取 其 同级 类目
        List<TbCategory> categoryList = libraryCategoryService.getCategoryByCid(libraryQuery.getCateId());
        // 获取当前类目信息
        TbCategory currentCategory = libraryCategoryService.getCategoryById(libraryQuery.getCateId());
        // 按照条件进行查询
        PageCount<TblibraryExt> libraryPageCount = libraryService.findLibraryByAll(libraryQuery, pageCount);
        // model 将数据设置到域中
        model.addAttribute("subCategoryList", categoryList);
        model.addAttribute("libraryPageCount", libraryPageCount);
        // 默认
        if (currentCategory == null) {
        BookExt bookInfo = libraryService.getBookInfoById(id);
        // 将 时间戳 进行转换
        Long dateSS = bookInfo.getLibrary().getCreatedate();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String formatDate = simpleDateFormat.format(new Date(dateSS * 1000));
        bookInfo.setFormatDate(formatDate);
        // 通过 图书id 获取 回复信息
        List<CommentExt> commentExts = commentService.findCommentByBookId(id);
        // 将 查询的 图书信息 设置到 域 中
        model.addAttribute("bookInfo", bookInfo);
        // 将 回复信息 设置到 域 汇总
        model.addAttribute("commentExts", commentExts);
        return "/user/bookDetail";
    }
    /**
     * 用于 借阅 图书  操作
     *
     * @param session 用于 取 用户信息
     * @param order   用户借阅关联信息
     * @return
     */
    @RequestMapping("/jieyue_book")
    public String jieyueBook(HttpSession session, Model model, String oid, String kkid, TbOrder order) {

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
一、项目简介 本项目是一套基于SpringBoot图书管理系统,主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的Java学习者。 包含:项目源码、数据库脚本、软件工具、项目说明等,该项目可以直接作为毕设使用。 项目都经过严格调试,确保可以运行! 二、技术实现 ​后台框架:SpringBoot ​数据库:MySQL 开发环境:JDK、IDEA、Tomcat 三、系统功能 本图书管理系统主要包含两种角色:读者和管理员。读者只能对个人信息的查阅、修改,图书的查询,而管理员则可以进行图书信息及借阅信息的管理。 具体实现功能如下: (1)系统登录。分为普通读者登录和管理员登录。 (2)系统管理。系统管理包括管理员设置,以及图书类别设置。管理员设置包括管理员信息的设置以及密码的设置。图书类别的设置只有管理员才可以对他进行新增,修改和删除。 (3)图书管理。包括图书信息管理,图书信息查询。只有管理员才可以对图书进行管理,图书查询是帮助读者方便查找图书信息。 (4)读者管理。读者管理包括读者信息管理,以及读者信息的查询。读者信息查询可以根据读者的姓名和编号进行查询。读者信息管理只对管理员有用,只有管理员可以添加读者,修改和删除读者的信息。 (5)图书借阅管理。图书借阅包括图书的借阅,归还以及续借。图书的借阅以及归还只对管理员起作用,只有通过管理员才可以进行图书的借阅以及归还。读者只能对图书进行续借的操作。 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值