基于javaweb的前台+后台精品图书管理系统(java+ssm+jsp+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+jsp的精品图书管理系统(前台、后台)(java+SSM+jsp+mysql+maven)
一、项目简述
功能包括: 登录注册,办理借阅。借阅记录,预约借阅,借出未还, 借阅逾期,学生管理,图书管理,书库分类查询搜索。
二、项目运行
环境配置: 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 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 userList = loan_userInfoList.selectLikeName(tbUserQueryVo);
model.addAttribute(“userList”, userList);
return “admin/loan_userList”;
图书借阅管理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 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 loanRecordList = (List) 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 loanRecordList = (List) 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 BespeakList = (List) 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 BespeakList = (List) 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”;