基于javaweb+mysql的ssm+maven情缘图书馆管理系统(java+ssm+tomcat+maven+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM+Maven情缘图书馆管理系统(java+ssm+tomcat+maven+mysql)
主要功能包括:
图书编目管理:图书编目、编目维护;
图书信息管理:图书录入、图书信息;
图书借阅管理:借阅图书、借阅信息、归还、续借;
读者管理:办证、读者信息、读者类别、证件操作;
系统管理:权限信息、用户权限;
软件架构
- SSM+Tomcat8.5+Maven3.6.3+JDK1.8+MySQL5.7
session.invalidate();
return "redirect:/login.action";
// 管理员登录
@RequestMapping("/adminlogin")
public String adminlogin(Model model, HttpSession session, String adminuser, String adminpassword) throws Exception {
String msg;
String url;
//判断用户名为空
if ("".equals(adminuser) || adminuser == null || "".equals(adminpassword) || adminpassword == null) {
msg = "用户名或密码不能为空!";
currentCategory.setId(0);
session.setAttribute("currentCategory", currentCategory.getId());
return "/user/user_bookList";
/**
* 通过 图书 id 查询 图书详细信息
* @param id
* @return
*/
@RequestMapping("/bookId")
public String toBookInfo(int id, Model model) {
* 删除类目信息
* @param id
* @return
*/
@RequestMapping(value = "/delCategory", method = RequestMethod.GET)
public String delCategory(int id) {
// 通过 类目id 删除数据
libraryCategoryService.delBookCategoryById(id);
return "redirect:/admin/ch/loan_BookClassify.action";
/**
* 修改 类目关系
* @param category
* @return
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);
currentCategory = new TbCategory();
currentCategory.setId(0);
session.setAttribute("currentCategory", currentCategory.getId());
return "/user/user_bookList";
/**
* 通过 图书 id 查询 图书详细信息
* @param id
* @return
*/
@RequestMapping("/bookId")
model.addAttribute("url", url);
//判断验证码是否错误
if (!validateCode.equals(authcode)) {
msg = "您输入的验证码错误!";
url = "/login.action";
model.addAttribute("msg", msg);
model.addAttribute("url", url);
return "user/error";
//如果都正确,注册用户
tbUser.setUsername(user);
tbUser.setPassword(pwd);
tbUser.setTelnum(tel);
@Autowired
private Login_loginValidation login_loginValidation;
@RequestMapping("/login")
public String login(Model model, HttpSession session, String user, String pwd, String passwd2, String tel, String authcode, String statu) throws Exception {
//提示信息
String msg;
//跳转页面
String url;
//登录
ActiveUser activeUser = new ActiveUser();
TbUser tbUser = new TbUser();
if ("1".equals(statu)) {
model.addAttribute("url", url);
//判断两次密码是否不一致
if (!pwd.equals(passwd2)) {
msg = "您输入的两次密码不一致!";
url = "/login.action";
model.addAttribute("msg", msg);
model.addAttribute("url", url);
//判断手机号是否为空
if (!"".equals(tel) || tel == null) {
msg = "手机号不能为空!";
url = "/login.action";
@Controller
@RequestMapping("/user/ch")
public class UserBookController {
// 注入
@Autowired
private LibraryService libraryService;
@Autowired
private LibraryCategoryService libraryCategoryService;
@Autowired
private CommentService commentService;
@Autowired
//判断用户名或密码是否为空
if ("".equals(user) || user == null || "".equals(pwd) || pwd == null) {
msg = "用户名或密码不能为空!";
url = "/login.action";
model.addAttribute("msg", msg);
model.addAttribute("url", url);
//判断两次密码是否不一致
if (!pwd.equals(passwd2)) {
msg = "您输入的两次密码不一致!";
url = "/login.action";
model.addAttribute("msg", msg);
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());
// 获取当前类目信息
msg = "用户名或密码错误!";
url = "/login.action";
model.addAttribute("msg", msg);
model.addAttribute("url", url);
return "user/error";
session.setAttribute("activeUser", activeUser);
return "redirect:/user/userSystem.action";
} else if ("2".equals(statu)) { //注册
//获取生成的验证码
String validateCode = (String) session.getAttribute("randomCode");
//判断用户名或密码是否为空
@Autowired
private CommentService commentService;
@Autowired
private TbOrderMapper orderMapper;
@Autowired
private TbRecordMapper recordMapper;
@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
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) {
//跳转页面
String url;
//登录
ActiveUser activeUser = new ActiveUser();
TbUser tbUser = new TbUser();
if ("1".equals(statu)) {
activeUser = this.login_loginValidation.authenticat(user, pwd);
if (activeUser == null) {
msg = "用户名或密码错误!";
url = "/login.action";
model.addAttribute("msg", msg);
model.addAttribute("url", url);
// 获取 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 中的用户信息
* @param category 图书类目信息
* @param session 添加人
* @return url
*/
@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())) {
// 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";
/**