基于javaweb+mysql的ssm学生二手书籍管理系统(java+ssm+elementui+vue+layui+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8、Node.js≥10
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM学生二手书籍管理系统(java+ssm+elementui+vue+layui+mysql)
项目介绍
SSM学生二手书籍交易平台
角色:管理员、卖家、用户
前台主要功能包括:首页、书籍信息、留言反馈、个人中心、购物车;
后台主要分为管理员、用户、卖家; 管理员主要功能:首页、个人中心、用户管理、卖家管理、书籍分类管理、书籍信息管理、留言板管理、管理员管理、系统管理; 用户主要功能:首页、个人中心、我的收藏管理、留言板管理; 卖家主要功能:首页、个人中心、书籍信息管理、订单管理;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7/8.0等版本均可;
技术栈
后端:SSM(Spring+SpringMVC+Mybatis)
前端:ElementUI+Vue+LayUI+bootstrap+jquery
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目; 3. 将项目中config.properties配置文件中的数据库配置改为自己的配置,然后运行; 网址:http://localhost:8080/ssmxm4f1/admin/dist/index.html 后台管理 管理员:abo 密码:abo 用户账号密码:用户1/123456 http://localhost:8080/ssmxm4f1/front/index.html 前台 用户账号密码:用户1/123456 卖家账号密码:卖家1/123456
//获取ShoppingItem
ShoppingItem si = cart.getItem(isbn);
if(si!=null){
si.inAmount();
//计算商品总价
cart.getTotalReal();
request.getSession().setAttribute("cart", cart);
//页面跳转
showCart(request, response);
/**
订单管理控制层:
@WebServlet("/OrderServlet")
public class OrderServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public OrderServlet() {
super();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//判断是否登录
if(request.getSession().getAttribute("user")==null){
//跳转页面
response.sendRedirect("login.jsp");
//编辑分类
if(opt.equals("edit")){
editCategoryByAdmin(request, response);
/**
* 添加分类
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
protected void addCategoryByAdmin(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//获取提交的参数
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//String opt = request.getParameter("opt");
String role = request.getParameter("role");
//判断是否为管理员操作
if(role!=null && role.equals("3")){
optByAdmin(request, response);
return;
/**
* 管理员操作
if(cart==null){
cart = new ShoppingCart();
//获取购买数量
String strNum = request.getParameter("num");
if(!StringUtil.isNumber(strNum))
strNum="1";
int num = Integer.parseInt(strNum);
//获取图书信息
String isbn = request.getParameter("isbn");
BookDaoImpl dao = new BookDaoImpl();
Books book = dao.getBooksByIsbn(isbn);
//把商品添加到购物车
cart.add(book, num);
cart.remove(isbn);
//商品种类减1
cart.setItemAmount();
//计算商品总价
cart.getTotalReal();
request.getSession().setAttribute("cart", cart);
showCart(request, response);
/**
* 显示购物车
* @param request
* @param response
* @throws ServletException
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//判断是否登录
if(request.getSession().getAttribute("user")==null){
//跳转页面
response.sendRedirect("login.jsp");
return;
//判断操作
String opt = request.getParameter("opt");
if(opt.equals("add")){
return;
//提取参数
int cId = Integer.parseInt(request.getParameter("cid"));
String name = request.getParameter("name");
if(name==null || name.equals("")){
response.sendRedirect("admin/categorylist.jsp");
return;
//封装对象
Categories c = new Categories();
c.setId(cId);
c.setName(name);
//调用dao层方法
CategoriesDaoImpl dao = new CategoriesDaoImpl();
* @throws IOException
*/
protected void deAmount(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//从session中获取ShoppingCart
ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("cart");
if(cart!=null){
String isbn = request.getParameter("isbn");
//信息完整性校验
if(isbn!=null && !isbn.equals("")){
//获取ShoppingItem
ShoppingItem si = cart.getItem(isbn);
if(si!=null && si.getAmount()>1)
si.deAmount();
protected void inAmount(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//从session中获取ShoppingCart
ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("cart");
if(cart!=null){
String isbn = request.getParameter("isbn");
//信息完整性校验
if(isbn!=null && !isbn.equals("")){
//获取ShoppingItem
ShoppingItem si = cart.getItem(isbn);
if(si!=null){
si.inAmount();
if(StringUtil.isNumber(request.getParameter("cid"))==false){
response.sendRedirect("admin/categorylist.jsp");
return;
//提取参数
int cId = Integer.parseInt(request.getParameter("cid"));
String name = request.getParameter("name");
if(name==null || name.equals("")){
response.sendRedirect("admin/categorylist.jsp");
return;
//封装对象
Categories c = new Categories();
c.setId(cId);
c.setName(name);
//获取ShoppingItem
ShoppingItem si = cart.getItem(isbn);
if(si!=null){
si.inAmount();
//计算商品总价
cart.getTotalReal();
request.getSession().setAttribute("cart", cart);
//页面跳转
showCart(request, response);
/**
* 减少购物车商品数量
return;
//封装对象
Categories cate = new Categories();
cate.setName(name);
//调用dao层方法
CategoriesDaoImpl dao = new CategoriesDaoImpl();
if(dao.addCategory(cate)){
request.getSession().setAttribute("ADMIN_MSG_CATEGORY", "添加成功");
//初始化分类集合
initCategory(request, response);
//跳转页面
response.sendRedirect("login.jsp");
return;
//判断操作
String opt = request.getParameter("opt");
if(opt.equals("add")){
addOrder(request, response);
if(opt.equals("show")){
showOrder(request, response);
/**
if(name==null || name.equals("")){
response.sendRedirect("admin/categorylist.jsp");
return;
//封装对象
Categories c = new Categories();
c.setId(cId);
c.setName(name);
//调用dao层方法
CategoriesDaoImpl dao = new CategoriesDaoImpl();
Boolean b = dao.updateCategory(c);
订单管理控制层:
@WebServlet("/OrderServlet")
public class OrderServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public OrderServlet() {
super();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//判断是否登录
if(request.getSession().getAttribute("user")==null){
//跳转页面
//跳转页面
response.sendRedirect("addcartok.jsp");
protected void clearCart(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("cart");
if(cart!=null){
cart.clear();
request.getSession().setAttribute("cart", cart);
//页面跳转
showCart(request, response);
/**
* 删除购物车中的商品
* @param request