Java项目:前台+后台精品图书管理系统(java+SSM+jsp+mysql+maven)

本文介绍了基于Spring Boot的图书借阅管理系统,涉及用户列表信息管理、借阅操作控制、预约记录处理等核心功能,包括登录注册、图书借阅、查询与管理等模块。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

源码获取:博客首页 "资源" 里下载!

一、项目简述

功能包括: 登录注册,办理借阅。借阅记录,预约借阅,借出未还, 借阅逾期,学生管理,图书管理,书库分类查询搜索。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。

用户列表信息:

/**
 * 用户列表信息
 */

@Controller
@RequestMapping("/admin")
public class Loan_UserInfoController {
    @Autowired
    private Loan_UserInfoList loan_userInfoList;

    //查询用户信息列表
    @RequestMapping("/loan_userList")
    public String userList(Model model) {
        List<TbUser> userList = loan_userInfoList.findUserList();
/*        for(TbUser t : userList) {
            System.out.println(t);
        }*/
        model.addAttribute("userList", userList);
        return "admin/loan_userList";
    }

    //用户信息修改页面
    @RequestMapping("/loan_editUser")
    public String editUser(Integer id, Model model) {
        TbUser tbUser = loan_userInfoList.updataUserInfo(id);
        model.addAttribute("tbUser", tbUser);
        return "admin/loan_editUser";
    }

    //用户信息修改提交
    @RequestMapping("/editUser")
    public String editUser(TbUser tbUser, Model model) {
        int i = loan_userInfoList.editUser(tbUser);
        if (i > 0) {
            return "redirect:loan_userList.action";
        }
        //进行数据回显
        model.addAttribute("tbUser", tbUser);
        return "admin/loan_editUser";
    }


    //用户删除
    @RequestMapping("/loan_deleteUser")
    public String loan_deleteUser(Integer id) {
        int i = loan_userInfoList.deleteUser(id);
        if (i > 0) {
            return "redirect:loan_userList.action";
        }
        return "redirect:loan_userList.action";
    }

    //用户添加
    @RequestMapping("/loan_addUser")
    public String addUser(TbUser tbUser) {
        //注册时间
        tbUser.setRegisterdate(System.currentTimeMillis());
        //not online
        tbUser.setIsonline(0);
        tbUser.setPassword(tbUser.getUsername());
        int i = loan_userInfoList.addUser(tbUser);
        if (i > 0) {
            System.out.println("添加成功!");
            return "redirect:loan_userList.action";
        }

        return "redirect:loan_userList.action";
    }

    //用户列表模糊查询用户信息(用户名)
    @RequestMapping("/loan_selectLikeName")
    public String Loan_selectLikeName(TbUser tbUser, Model model) {
        Integer online = null;
        TbUserQueryVo tbUserQueryVo = new TbUserQueryVo();
        tbUserQueryVo.setTbUser(tbUser);
        tbUserQueryVo.setOnline(online);
        List<TbUser> userList = loan_userInfoList.selectLikeName(tbUserQueryVo);
        model.addAttribute("userList", userList);
        return "admin/loan_userList";
    }
}

图书借阅管理Controller:

/**
 * 图书借阅管理Controller
 *
 **/
@Controller
@RequestMapping("/admin")
public class Loan_LoanListController {
    @Autowired
    private Loan_management loan_management;

    @Autowired
    private LibraryService libraryService;
    @Autowired
    private TbLibraryMapper tbLibraryMapper;
    @Autowired
    private TbRecordMapper recordMapper;
    @Autowired
    private Loan_UserInfoList loan_userInfoList;


    @RequestMapping("/loan/to_jieyue_book2")
    public String jieyue_book2(Model model) {
        return "admin/jieshu_book";
    }

    @RequestMapping("/loan/jieyue_book2")
    public String jieyue_book2(HttpSession session, String xuehao, String barcode, Model model) {
        TbLibrary book = tbLibraryMapper.selectByBarcode(barcode);
        if (null == book) {
            model.addAttribute("errorMsg", "图书条形码不存在");
            return "errorMsg";
        }
        TbUser tbUser = tbLibraryMapper.selectByStuNum(xuehao);
        if (null == tbUser) {
            model.addAttribute("errorMsg", "学生学号不存在");
            return "errorMsg";
        }
        //逾期,未归还
        Integer id=tbUser.getId();
        List<TbRecordQueryVo> recordOverdueList = loan_userInfoList.selectRecordOverdue(id);
        for (TbRecordQueryVo vo : recordOverdueList) {
            if (vo.getTicketffee() < 0) {
                model.addAttribute("errorMsg", "该学生有欠款不可以借阅");
                return "errorMsg";
            }
        }


        TbRecord record = new TbRecord();
        // 获取 session 中的用户信息
        record.setUserId(tbUser.getId());
        record.setBookId(book.getId());
        Long currentTimeS = System.currentTimeMillis() / 1000;
        record.setRecorddate(currentTimeS); //预约 借阅时间
        record.setBackdate(currentTimeS + 3 * 30 * 24 * 60 * 60); //预约 3个月天 时间
        record.setTicketffee(0f);
        record.setReturnbook(0);
        // 插入数据
        recordMapper.insert(record);
        model.addAttribute("successMsg", "借阅成功");
        return "errorMsg";
    }


    //借阅列表显示
    @RequestMapping("/loan/loanList")
    public String loanList(Model model, Integer currentPage) throws Exception {
        TbRecordL tbRecordL = new TbRecordL();
        //如果传入的有页面
        if (currentPage != null) {
            tbRecordL.setCurrentPage(currentPage);
        }
        //查询数据和分页,并返回
        pageL pageL = this.loan_management.getLoanRecord(tbRecordL);
        List<TbRecordL> loanRecordList = (List<TbRecordL>) pageL.getPo();

        model.addAttribute("pageL", pageL);
        model.addAttribute("loanRecordList", loanRecordList);
        return "admin/loan_loanList";
    }

    //借阅列表搜素
    @RequestMapping("/loan/searchLoanList.action")
    public String searchLoanList(Model model, String searchSelect, String searchKeyWord) throws Exception {
        //实例化包装类(包装类中在原有类的基础上添加的column(列名称)和keyword(搜索关键字)两个字段)
        TbRecordSearchL tbRecordSearchL = new TbRecordSearchL();
        tbRecordSearchL.setColumn(searchSelect);
        tbRecordSearchL.setKeyWord(searchKeyWord);
        //将查询结果保存到list集合并通过model将对象集合放入request域中
        pageL pageL = this.loan_management.getLoanRecord(tbRecordSearchL);
        List<TbRecordL> loanRecordList = (List<TbRecordL>) pageL.getPo();
        model.addAttribute("loanRecordList", loanRecordList);
        return "admin/loan_loanList";
    }

    //    借阅列表归还状态修改
    @RequestMapping("/loan/changeLoanStatus")
    public String changeLoanStatus(Model model, String recid, String status) throws Exception {
        loanStatusL loanStatusL = new loanStatusL();
        loanStatusL.setId(recid);
        loanStatusL.setStatus(status);
        this.loan_management.changLoanStatus(loanStatusL);
        //返回借阅列表
        return "redirect:/admin/loan/loanList.action";
    }
}

预约记录控制层:

/**
 * 预约记录
 **/
@Controller
@RequestMapping("/admin")
public class Loan_BespeakRecordController {
    @Autowired
    private Loan_management loan_management;

    //数据列表
    @RequestMapping("/loan/bespeakList")
    public String BespeakList(Model model, Integer currentPage) throws Exception {
        TbOrderL tbOrderL = new TbOrderL();
        //如果传入的有页面
        if (currentPage != null) {
            tbOrderL.setCurrentPage(currentPage);
        }
        //查询数据和分页,并返回
        pageL pageL = new pageL();
        pageL = this.loan_management.getBespeakRecord(tbOrderL);
        List<TbOrderL> BespeakList = (List<TbOrderL>) pageL.getPo();
        model.addAttribute("pageL", pageL);
        model.addAttribute("BespeakList", BespeakList);
        return "admin/loan_bespeak";
    }

    //列表查询
    @RequestMapping("/loan/searchBespeak")
    public String searchBespeak(Model model, String searchSelect, String searchKeyWord, Integer currentPage) throws Exception {
        TbOrderL tbOrderL = new TbOrderL();
        //如果传入的有页面
        if (currentPage != null) {
            tbOrderL.setCurrentPage(currentPage);
        }
        //实例化包装类(包装类中在原有类的基础上添加的column(列名称)和keyword(搜索关键字)两个字段)
        tbOrderL.setColumn(searchSelect);
        tbOrderL.setKeyWord(searchKeyWord);
        pageL pageL = new pageL();
        pageL = this.loan_management.getBespeakRecord(tbOrderL);
        List<TbOrderL> BespeakList = (List<TbOrderL>) pageL.getPo();
        model.addAttribute("pageL", pageL);
        model.addAttribute("BespeakList", BespeakList);
        return "admin/loan_bespeak";
    }

    //    领取操作
    @RequestMapping("/loan/getBespeak")
    public String getBespeak(Model model, Integer id, Integer bookid, Integer userid) throws Exception {
        //通过bookid和userid 借阅表插入借阅记录
        TbRecord tbRecord = new TbRecord();
        tbRecord.setBookId(bookid);
        tbRecord.setUserId(userid);
        this.loan_management.addLoanList(tbRecord);

        //通过id删除预约记录
        this.loan_management.removeOrderList(id);

        //返回借阅列表
        return "redirect:/admin/loan/bespeakList.action";
    }

    //    删除预约记录
    @RequestMapping("/loan/removeBespeak")
    public String removeBespeak(Integer id) throws Exception {
        this.loan_management.removeOrderList(id);
        return "redirect:/admin/loan/bespeakList.action";
    }
}

源码获取:博客首页 "资源" 里下载!

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

OldWinePot

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值