协同过滤-图书馆图书推荐系统(JAVA,JSP,SSM,MYSQL)(毕业论文27564字,共78页,程序代码,MySQL数据库)
链接:https://pan.baidu.com/s/1PilFCeVoH3S2VYwfrdMgnQ
提取码:8888
【运行环境】 Eclipse, IDEA JDK1.8(JDK1.7) Tomcat8(Tomcat7)
【技术栈】 JAVA, JSP, SSM, JQUERY, MYSQL, HTML, CSS, JAVASCRIPT
【视频教程】
【项目包含内容】
【文档包含内容】
【项目功能介绍】
本系统提供了用户登录,注册,修改密码,修改用户信息,首页展示,轮播图展示,网站新闻管理、全部图书展示,图书详情,订阅图书,取消订阅,续借图书,评价图书,用户留言等前台功能、管理员管理,用户管理,网站新闻管理,图书类型管理,图书管理,图书借阅管理,评价管理,留言管理等后台功能。
【部分代码】
AdminAction.java
package com.action;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.entity.Admin;
import com.service.AdminService;
import com.util.PageHelper;
import com.util.VeDate;
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/admin", produces = "text/plain;charset=utf-8")
public class AdminAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private AdminService adminService;
// 管理员登录 1 验证用户名是否存在 2 验证密码是否正确
@RequestMapping("login.action")
public String login() {
String username = this.getRequest().getParameter("username");
String password = this.getRequest().getParameter("password");
Admin adminEntity = new Admin();
adminEntity.setUsername(username);
List adminlist = this.adminService.getAdminByCond(adminEntity);
if (adminlist.size() == 0) {
this.getRequest().setAttribute("message", "用户名不存在");
return "admin/index";
} else {
Admin admin = adminlist.get(0);
if (password.equals(admin.getPassword())) {
this.getSession().setAttribute("adminid", admin.getAdminid());
this.getSession().setAttribute("adminname", admin.getUsername());
this.getSession().setAttribute("realname", admin.getRealname());
} else {
this.getRequest().setAttribute("message", "密码错误");
return "admin/index";
}
}
return "admin/main";
}
// 修改密码
@RequestMapping("editpwd.action")
public String editpwd() {
String adminid = (String) this.getSession().getAttribute("adminid");
String password = this.getRequest().getParameter("password");
String repassword = this.getRequest().getParameter("repassword");
Admin admin = this.adminService.getAdminById(adminid);
if (password.equals(admin.getPassword())) {
admin.setPassword(repassword);
this.adminService.updateAdmin(admin);
} else {
this.getRequest().setAttribute("message", "旧密码错误");
}
return "admin/editpwd";
}
// 管理员退出登录
@RequestMapping("exit.action")
public String exit() {
this.getSession().removeAttribute("adminid");
this.getSession().removeAttribute("adminname");
this.getSession().removeAttribute("realname");
return "admin/index";
}
// 准备添加数据
@RequestMapping("createAdmin.action")
public String createAdmin() {
return "admin/addadmin";
}
// 添加数据
@RequestMapping("addAdmin.action")
public String addAdmin(Admin admin) {
admin.setAddtime(VeDate.getStringDateShort());
this.adminService.insertAdmin(admin);
return "redirect:/admin/createAdmin.action";
}
// 通过主键删除数据
@RequestMapping("deleteAdmin.action")
public String deleteAdmin(String id) {
this.adminService.deleteAdmin(id);
return "redirect:/admin/getAllAdmin.action";
}
// 批量删除数据
@RequestMapping("deleteAdminByIds.action")
public String deleteAdminByIds() {
String[] ids = this.getRequest().getParameterValues("adminid");
for (String adminid : ids) {
this.adminService.deleteAdmin(adminid);
}
return "redirect:/admin/getAllAdmin.action";
}
// 更新数据
@RequestMapping("updateAdmin.action")
public String updateAdmin(Admin admin) {
this.adminService.updateAdmin(admin);
return "redirect:/admin/getAllAdmin.action";
}
// 显示全部数据
@RequestMapping("getAllAdmin.action")
public String getAllAdmin(String number) {
List adminList = this.adminService.getAllAdmin();
PageHelper.getPage(adminList, "admin", null, null, 10, number, this.getRequest(), null);
return "admin/listadmin";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("queryAdminByCond.action")
public String queryAdminByCond(String cond, String name, String number) {
Admin admin = new Admin();
if (cond != null) {
if ("username".equals(cond)) {
admin.setUsername(name);
}
if ("password".equals(cond)) {
admin.setPassword(name);
}
if ("realname".equals(cond)) {
admin.setRealname(name);
}
if ("contact".equals(cond)) {
admin.setContact(name);
}
if ("addtime".equals(cond)) {
admin.setAddtime(name);
}
}
List nameList = new ArrayList();
List valueList = new ArrayList();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.adminService.getAdminByLike(admin), "admin", nameList, valueList, 10, number, this.getRequest(), "query");
name = null;
cond = null;
return "admin/queryadmin";
}
// 按主键查询数据
@RequestMapping("getAdminById.action")
public String getAdminById(String id) {
Admin admin = this.adminService.getAdminById(id);
this.getRequest().setAttribute("admin", admin);
return "admin/editadmin";
}
public AdminService getAdminService() {
return adminService;
}
public void setAdminService(AdminService adminService) {
this.adminService = adminService;
}
}
// 程序开发 QQ 549710689 可以付费修改
ArticleAction.java
package com.action;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.entity.Article;
import com.service.ArticleService;
import com.util.PageHelper;
import com.util.VeDate;
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/article", produces = "text/plain;charset=utf-8")
public class ArticleAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private ArticleService articleService;
// 准备添加数据
@RequestMapping("createArticle.action")
public String createArticle() {
return "admin/addarticle";
}
// 添加数据
@RequestMapping("addArticle.action")
public String addArticle(Article article) {
article.setAddtime(VeDate.getStringDateShort());
article.setHits("0");
this.articleService.insertArticle(article);
return "redirect:/article/createArticle.action";
}
// 通过主键删除数据
@RequestMapping("deleteArticle.action")
public String deleteArticle(String id) {
this.articleService.deleteArticle(id);
return "redirect:/article/getAllArticle.action";
}
// 批量删除数据
@RequestMapping("deleteArticleByIds.action")
public String deleteArticleByIds() {
String[] ids = this.getRequest().getParameterValues("articleid");
for (String articleid : ids) {
this.articleService.deleteArticle(articleid);
}
return "redirect:/article/getAllArticle.action";
}
// 更新数据
@RequestMapping("updateArticle.action")
public String updateArticle(Article article) {
this.articleService.updateArticle(article);
return "redirect:/article/getAllArticle.action";
}
// 显示全部数据
@RequestMapping("getAllArticle.action")
public String getAllArticle(String number) {
List articleList = this.articleService.getAllArticle();
PageHelper.getPage(articleList, "article", null, null, 10, number, this.getRequest(), null);
return "admin/listarticle";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("queryArticleByCond.action")
public String queryArticleByCond(String cond, String name, String number) {
Article article = new Article();
if (cond != null) {
if ("title".equals(cond)) {
article.setTitle(name);
}
if ("image".equals(cond)) {
article.setImage(name);
}
if ("contents".equals(cond)) {
article.setContents(name);
}
if ("addtime".equals(cond)) {
article.setAddtime(name);
}
if ("hits".equals(cond)) {
article.setHits(name);
}
}
List nameList = new ArrayList();
List valueList = new ArrayList();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.articleService.getArticleByLike(article), "article", nameList, valueList, 10, number, this.getRequest(),
"query");
name = null;
cond = null;
return "admin/queryarticle";
}
// 按主键查询数据
@RequestMapping("getArticleById.action")
public String getArticleById(String id) {
Article article = this.articleService.getArticleById(id);
this.getRequest().setAttribute("article", article);
return "admin/editarticle";
}
public ArticleService getArticleService() {
return articleService;
}
public void setArticleService(ArticleService articleService) {
this.articleService = articleService;
}
}
// 程序开发 QQ 549710689 可以付费修改
ComplainsAction.java
package com.action;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.entity.Complains;
import com.service.ComplainsService;
import com.entity.Users;
import com.service.UsersService;
import com.util.PageHelper;
import com.util.VeDate;
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/complains", produces = "text/plain;charset=utf-8")
public class ComplainsAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private ComplainsService complainsService;
@Autowired
@Resource
private UsersService usersService;
// 准备添加数据
@RequestMapping("createComplains.action")
public String createComplains() {
List usersList = this.usersService.getAllUsers();
this.getRequest().setAttribute("usersList", usersList);
return "admin/addcomplains";
}
// 添加数据
@RequestMapping("addComplains.action")
public String addComplains(Complains complains) {
complains.setUsersid("");
complains.setAddtime(VeDate.getStringDateShort());
complains.setStatus("");
this.complainsService.insertComplains(complains);
return "redirect:/complains/createComplains.action";
}
// 通过主键删除数据
@RequestMapping("deleteComplains.action")
public String deleteComplains(String id) {
this.complainsService.deleteComplains(id);
return "redirect:/complains/getAllComplains.action";
}
// 批量删除数据
@RequestMapping("deleteComplainsByIds.action")
public String deleteComplainsByIds() {
String[] ids = this.getRequest().getParameterValues("complainsid");
for (String complainsid : ids) {
this.complainsService.deleteComplains(complainsid);
}
return "redirect:/complains/getAllComplains.action";
}
// 更新数据
@RequestMapping("updateComplains.action")
public String updateComplains(Complains complains) {
this.complainsService.updateComplains(complains);
return "redirect:/complains/getAllComplains.action";
}
// 显示全部数据
@RequestMapping("getAllComplains.action")
public String getAllComplains(String number) {
List complainsList = this.complainsService.getAllComplains();
PageHelper.getPage(complainsList, "complains", null, null, 10, number, this.getRequest(), null);
return "admin/listcomplains";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("queryComplainsByCond.action")
public String queryComplainsByCond(String cond, String name, String number) {
Complains complains = new Complains();
if (cond != null) {
if ("usersid".equals(cond)) {
complains.setUsersid(name);
}
if ("contents".equals(cond)) {
complains.setContents(name);
}
if ("addtime".equals(cond)) {
complains.setAddtime(name);
}
if ("status".equals(cond)) {
complains.setStatus(name);
}
if ("reps".equals(cond)) {
complains.setReps(name);
}
}
List nameList = new ArrayList();
List valueList = new ArrayList();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.complainsService.getComplainsByLike(complains), "complains", nameList, valueList, 10, number, this.getRequest(),
"query");
name = null;
cond = null;
return "admin/querycomplains";
}
// 按主键查询数据
@RequestMapping("getComplainsById.action")
public String getComplainsById(String id) {
Complains complains = this.complainsService.getComplainsById(id);
this.getRequest().setAttribute("complains", complains);
List usersList = this.usersService.getAllUsers();
this.getRequest().setAttribute("usersList", usersList);
return "admin/editcomplains";
}
public ComplainsService getComplainsService() {
return complainsService;
}
public void setComplainsService(ComplainsService complainsService) {
this.complainsService = complainsService;
}
}
// 程序开发 QQ 549710689 可以付费修改
【文档部分截图】
【项目运行截图】