本帖最后由 wushaominkk 于 2019-6-26 08:26 编辑
这是我软件工程课程设计的项目。下面截图有具体的项目需求。我用的是SSM+Bootstrap+Mysql
下面是一部分代码:
[Java] 纯文本查看 复制代码 package com.xian.web.controller;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.xian.pojo.Borrows;
import com.xian.pojo.Reserve;
import com.xian.service.AdminService;
@Controller
@RequestMapping("/admin")
public class AdminController
{
@Autowired
private AdminService adminService;
@RequestMapping("/index")
public String toIndex()
{
return "/admin/index";
}
@RequestMapping("/quit")
public String quit(HttpSession session)
{
session.removeAttribute("user");
return "redirect:/index";
}
@RequestMapping("/show")
public String toshow(Model model,Borrows borrow)
{
List<Borrows> borrows = adminService.getBorrows(borrow);
for (Borrows borrows2 : borrows)
{
System.out.println(borrows2);
}
model.addAttribute("borrows", borrows);
return "/admin/show";
}
@RequestMapping("/allow")
public String allowBorrows(Integer id)
{
//审批,并增加未归还书籍
adminService.updateBorrows(id);
adminService.inserBackBooks(id);
//书籍数目减1
int booksId = adminService.selectBooksId(id);
adminService.descBooks(booksId);
return "redirect:/admin/show";
}
@RequestMapping("/notAllow")
public String notAllow(Integer id)
{
adminService.notAllowBorrows(id);
//更新结束时间
Date endTime=new Date();
Borrows borrow=new Borrows();
borrow.setId(id);
borrow.setEndTime(endTime);
adminService.updateBorrowsTime(borrow);
return "redirect:/admin/show";
}
@RequestMapping("/backBooks")
public String getBackBooks(Model model)
{
List<Borrows> backBooks = adminService.getBackBooks();
model.addAttribute("backBooks", backBooks);
return "/admin/showBackBook";
}
@RequestMapping("/allowBackBook")
public String allowBackBook(Integer id)
{
adminService.allowBackBook(id);
int borrowsId = adminService.selectBorrowsId(id);
int booksId = adminService.selectBooksId(borrowsId);
//书籍数目加1
adminService.updateBooks(booksId);
//更新归还时间
Date endTime=new Date();
Borrows borrow=new Borrows();
borrow.setId(borrowsId);
borrow.setEndTime(endTime);
adminService.updateBorrowsTime(borrow);
return "redirect:/admin/backBooks";
}
//获得所有预定书籍信息
@RequestMapping("/showReserveBook")
public String showReserveBook(Model model)
{
List<Reserve> allReserves = adminService.getAllReserve();
model.addAttribute("allReserves", allReserves);
return "/admin/showReserveBook";
}
//允许预定书籍信息
@RequestMapping("/allowReserveBook")
public String allowReserveBook(Integer id)
{
adminService.updateReserveBook(id);
//预定处理时间
Date endTime=new Date();
Reserve reserve=new Reserve();
reserve.setId(id);
reserve.setEndTime(endTime);
adminService.updateReserveTime(reserve);
return "redirect:/admin/showReserveBook";
}
//允许预定书籍信息
@RequestMapping("/notAllowReserveBook")
public String notAllowReserveBook(Integer id)
{
adminService.notAllowReserveBook(id);
Date endTime=new Date();
Reserve reserve=new Reserve();
reserve.setId(id);
reserve.setEndTime(endTime);
adminService.updateReserveTime(reserve);
return "redirect:/admin/showReserveBook";
}
}
然后下面登录界面和三个权限的用户界面图:
登录界面:
普通用户界面:
图书管理员:
系统管理员:
链接:https://pan.baidu.com/s/1soOTs02A3A6m8aLrizBWDw
提取码:1bo1
使用说明:导入项目后,输入http://localhost:8080/LibrarySystem/index,就可以访问登录页面了,然后三个权限的登录账号密码可以自己加,或者看我附件的sql文件。这里先提供三个可用的账号:
普通用户:xian 123
图书馆管理员:long 123
系统管理员:yang 123
然后第一次发帖,有什么不对的地方希望大家可以指出来,然后想要交流java 的也可以相互谈论,楼主九月份即将大四,希望能在暑假再增强一下自己的实力。 |