源码获取:俺的博客首页 "资源" 里下载!
项目介绍
Springboot+vue小徐影城管理系统
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
技术栈
后端:SpringBoot+Mybaits
前端:Vue + elementui
使用说明
项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入地址:
前台地址:http://localhost:8080/springbootm3kwm/front/index.html
后台地址
http://localhost:8080/springbootm3kwm/admin/dist/index.html
管理员 abo 密码 abo
用户:用户1 密码: 123456
注意项目文件路径中不能含有中文、空格、特殊字符等,否则图片会上传不成功。
用户管理控制层:
public class user_servlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
String type=req.getParameter("type");
if(type.endsWith("userReg"))
{
userReg(req, res);
}
if(type.endsWith("userLogout"))
{
userLogout(req, res);
}
if(type.endsWith("userEditMe"))
{
userEditMe(req, res);
}
if(type.endsWith("userMana"))
{
userMana(req, res);
}
if(type.endsWith("userDel"))
{
userDel(req, res);
}
}
public void userReg(HttpServletRequest req,HttpServletResponse res)
{
String id=String.valueOf(new Date().getTime());
String loginname=req.getParameter("loginname");
String loginpw=req.getParameter("loginpw");
String name=req.getParameter("name");
String del="no";
String s=liuService.panduan_zhanghao(loginname);
if(s.equals("yizhan"))
{
req.setAttribute("message", "账号已被占用,请输入其他账号");
req.setAttribute("path", "site/userreg/userreg.jsp");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
else
{
String sql="insert into t_user values(?,?,?,?,?)";
Object[] params={id,loginname,loginpw,name,del};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("message", "注册成功,请登录");
req.setAttribute("path", "site/default.jsp");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
}
public void userLogout(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
HttpSession session=req.getSession();
session.setAttribute("userType", null);
session.setAttribute("user", null);
req.setAttribute("message", "成功退出系统");
req.setAttribute("path", "site/default.jsp");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
public void userEditMe(HttpServletRequest req,HttpServletResponse res)
{
String id=req.getParameter("id");
String loginname=req.getParameter("loginname");
String loginpw=req.getParameter("loginpw");
String name=req.getParameter("name");
String sql="update t_user set loginname=?,loginpw=?,name=? where id=?";
Object[] params={loginname,loginpw,name,id};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("message", "修改成功,重新等后生效");
req.setAttribute("path", "site/default.jsp");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
public void userMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List userList=new ArrayList();
String sql="select * from t_user where del='no'";
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
Tuser user=new Tuser();
user.setId(rs.getString("id"));
user.setLoginname(rs.getString("loginname"));
user.setLoginpw(rs.getString("loginpw"));
user.setLoginpw(rs.getString("loginpw"));
user.setName(rs.getString("name"));
userList.add(user);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("userList", userList);
req.getRequestDispatcher("admin/user/userMana.jsp").forward(req, res);
}
public void userDel(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String id=req.getParameter("id");
String sql="update t_user set del='yes' where id=?";
Object[] params={id};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("msg", "用户信息删除完毕");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void destroy()
{
}
}
订单管理控制层:
public class order_servlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
String type=req.getParameter("type");
if(type.endsWith("orderMana"))
{
orderMana(req, res);
}
if(type.endsWith("orderDel"))
{
orderDel(req, res);
}
if(type.endsWith("orderShouli"))
{
orderShouli(req, res);
}
}
public void orderMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List orderList=new ArrayList();
String sql="select * from t_order order by zhuangtai desc";
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
Torder order=new Torder();
order.setId(rs.getString("id"));
order.setBianhao(rs.getString("bianhao"));
order.setShijian(rs.getString("shijian"));
order.setZhuangtai(rs.getString("zhuangtai"));
order.setSonghuodizhi(rs.getString("songhuodizhi"));
order.setFukuanfangshi(rs.getString("fukuanfangshi"));
order.setJine(rs.getInt("jine"));
order.setUser_id(rs.getString("user_id"));
orderList.add(order);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("orderList", orderList);
req.getRequestDispatcher("admin/order/orderMana.jsp").forward(req, res);
}
public void orderDel(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String id=req.getParameter("id");
String sql="delete from t_order where id=?";
Object[] params={id};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("msg", "信息删除完毕");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
public void orderShouli(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String id=req.getParameter("id");
String sql="update t_order set zhuangtai='yes' where id=?";
Object[] params={id};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("msg", "订单受理完毕");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void destroy()
{
}
}
留言管理控制层:
public class liuyan_servlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
String type=req.getParameter("type");
if(type.endsWith("liuyanAdd"))
{
liuyanAdd(req, res);
}
if(type.endsWith("liuyanMana"))
{
liuyanMana(req, res);
}
if(type.endsWith("liuyanDel"))
{
liuyanDel(req, res);
}
if(type.endsWith("liuyanHuifu"))
{
liuyanHuifu(req, res);
}
if(type.endsWith("liuyanAll"))
{
liuyanAll(req, res);
}
if(type.endsWith("liuyanDetail"))
{
liuyanDetail(req, res);
}
}
public void liuyanAdd(HttpServletRequest req,HttpServletResponse res)
{
HttpSession session=req.getSession();
Tuser user=(Tuser)session.getAttribute("user");
String neirong=req.getParameter("neirong");
String liuyanshi=new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
String user_id=user.getId();
String huifu="";
String huifushi="";
String sql="insert into t_liuyan(neirong,liuyanshi,user_id,huifu,huifushi) values(?,?,?,?,?)";
Object[] params={neirong,liuyanshi,user_id,huifu,huifushi};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("msg", "留言完毕");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
public void liuyanMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List liuyanList=new ArrayList();
String sql="select * from t_liuyan order by liuyanshi";
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
TLiuyan liuyan=new TLiuyan();
liuyan.setId(rs.getInt("id"));
liuyan.setNeirong(rs.getString("neirong"));
liuyan.setLiuyanshi(rs.getString("liuyanshi"));
liuyan.setUser_id(rs.getString("user_id"));
liuyan.setHuifu(rs.getString("huifu"));
liuyan.setHuifushi(rs.getString("huifushi"));
liuyanList.add(liuyan);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("liuyanList", liuyanList);
req.getRequestDispatcher("admin/liuyan/liuyanMana.jsp").forward(req, res);
}
public void liuyanDel(HttpServletRequest req,HttpServletResponse res)
{
String sql="delete from t_liuyan where id="+Integer.parseInt(req.getParameter("id"));
Object[] params={};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("msg", "留言信息删除完毕");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
public void liuyanHuifu(HttpServletRequest req,HttpServletResponse res)
{
String huifu=req.getParameter("huifu");
String huifushi=new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
int id=Integer.parseInt(req.getParameter("id"));
String sql="update t_liuyan set huifu=?,huifushi=? where id=?";
Object[] params={huifu,huifushi,id};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("msg", "回复完毕完毕");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
public void liuyanAll(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List liuyanList=new ArrayList();
String sql="select * from t_liuyan order by liuyanshi";
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
TLiuyan liuyan=new TLiuyan();
liuyan.setId(rs.getInt("id"));
liuyan.setNeirong(rs.getString("neirong"));
liuyan.setLiuyanshi(rs.getString("liuyanshi"));
liuyan.setUser_id(rs.getString("user_id"));
liuyan.setHuifu(rs.getString("huifu"));
liuyan.setHuifushi(rs.getString("huifushi"));
liuyanList.add(liuyan);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("liuyanList", liuyanList);
req.getRequestDispatcher("site/liuyan/liuyanAll.jsp").forward(req, res);
}
public void liuyanDetail(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
int id=Integer.parseInt(req.getParameter("id"));
req.setAttribute("liuyan", get_liuyan(id));
req.getRequestDispatcher("site/liuyan/liuyanDetail.jsp").forward(req, res);
}
public TLiuyan get_liuyan(int id)
{
TLiuyan liuyan=new TLiuyan();
String sql="select * from t_liuyan where id=?";
Object[] params={id};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
liuyan.setId(rs.getInt("id"));
liuyan.setNeirong(rs.getString("neirong"));
liuyan.setLiuyanshi(rs.getString("liuyanshi"));
liuyan.setUser_id(rs.getString("user_id"));
liuyan.setHuifu(rs.getString("huifu"));
liuyan.setHuifushi(rs.getString("huifushi"));
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
return liuyan;
}
public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void destroy()
{
}
}
商品管理控制层:
public class goods_servlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
String type=req.getParameter("type");
if(type.endsWith("goodsAdd"))
{
goodsAdd(req, res);
}
if(type.endsWith("goodsMana"))
{
goodsMana(req, res);
}
if(type.endsWith("goodsDel"))
{
goodsDel(req, res);
}
if(type.endsWith("goodsDetailHou"))
{
goodsDetailHou(req, res);
}
if(type.endsWith("goodsAll"))
{
goodsAll(req, res);
}
if(type.endsWith("goodsByCatelog"))
{
goodsByCatelog(req, res);
}
if(type.endsWith("goodsDetailQian"))
{
goodsDetailQian(req, res);
}
}
public void goodsAdd(HttpServletRequest req,HttpServletResponse res)
{
String id=String.valueOf(new Date().getTime());
String fangyingshi=req.getParameter("fangyingshi");
String catelog_id=req.getParameter("catelog_id");
String mingcheng=req.getParameter("mingcheng");
String jieshao=req.getParameter("jieshao");
String fujian=req.getParameter("fujian");
int shichangjia=Integer.parseInt(req.getParameter("shichangjia"));
int tejia=Integer.parseInt(req.getParameter("shichangjia"));
String del="no";
String sql="insert into t_goods(id,fangyingshi,catelog_id,mingcheng,jieshao,fujian,shichangjia,tejia,del) " +
"values(?,?,?,?,?,?,?,?,?)";
Object[] params={id,fangyingshi,catelog_id,mingcheng,jieshao,fujian,shichangjia,tejia,del};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("msg", "操作成功");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
public void goodsMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List goodsList=new ArrayList();
String sql="select * from t_goods where del='no' order by fangyingshi desc";
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
Tgoods goods=new Tgoods();
goods.setId(rs.getString("id"));
goods.setFangyingshi(rs.getString("fangyingshi"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
goodsList.add(goods);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("goodsList", goodsList);
req.getRequestDispatcher("admin/goods/goodsMana.jsp").forward(req, res);
}
public void goodsDel(HttpServletRequest req,HttpServletResponse res)
{
String id=req.getParameter("id");
String sql="update t_goods set del='yes' where id="+id;
Object[] params={};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("msg", "操作成功");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
public void goodsDetailHou(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String id=req.getParameter("id");
req.setAttribute("goods", liuService.getGoods(id));
req.getRequestDispatcher("admin/goods/goodsDetailHou.jsp").forward(req, res);
}
public void goodsAll(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List goodsList=new ArrayList();
//String sql="select * from t_goods where del='no' and fangyingshi >? order by fangyingshi desc";
String sql="select * from t_goods where del='no' order by fangyingshi desc";
Object[] params={new SimpleDateFormat("yyyy-MM-dd").format(new Date())};
DB mydb=new DB();
try
{
mydb.doPstm(sql, null);
ResultSet rs=mydb.getRs();
while(rs.next())
{
Tgoods goods=new Tgoods();
goods.setId(rs.getString("id"));
goods.setFangyingshi(rs.getString("fangyingshi"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
goodsList.add(goods);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
if(goodsList.size()>8)
{
goodsList=goodsList.subList(0, 8);
}
req.setAttribute("goodsList", goodsList);
req.getRequestDispatcher("site/goods/goodsAll.jsp").forward(req, res);
}
public void goodsByCatelog(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String catelog_id=req.getParameter("catelog_id");
req.setAttribute("goodsList", liuService.goodsByCatelog(catelog_id));
req.getRequestDispatcher("site/goods/goodsByCatelog.jsp").forward(req, res);
}
public void goodsDetailQian(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String id=req.getParameter("id");
req.setAttribute("goods", liuService.getGoods(id));
req.getRequestDispatcher("site/goods/goodsDetailQian.jsp").forward(req, res);
}
public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void destroy()
{
}
}
售票管理控制层:
public class buy_servlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
String type=req.getParameter("type");
if(type.endsWith("addToCart"))
{
addToCart(req, res);
}
if(type.endsWith("orderSubmit"))
{
orderSubmit(req, res);
}
if(type.endsWith("myorder"))
{
myorder(req, res);
}
if(type.endsWith("orderDetail"))
{
orderDetail(req, res);
}
}
public void addToCart(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String goods_id=req.getParameter("goods_id");
int quantity=Integer.parseInt(req.getParameter("quantity"));
Tgoods goods=liuService.getGoods(goods_id);
TorderItem orderItem=new TorderItem();
orderItem.setGoods(goods);
orderItem.setGoods_quantity(quantity);
HttpSession session=req.getSession();
Cart cart =(Cart)session.getAttribute("cart");
cart.addGoods(goods_id, orderItem);
session.setAttribute("cart", cart);
req.setAttribute("message", "操作成功");
req.setAttribute("path", "site/cart/mycart.jsp");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
public void orderSubmit(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String songhuodizhi=req.getParameter("songhuodizhi");
String fukuanfangshi=req.getParameter("fukuanfangshi");
HttpSession session=req.getSession();
Cart cart =(Cart)session.getAttribute("cart");
Tuser user=(Tuser)session.getAttribute("user");
Torder order=new Torder();
order.setId(String.valueOf(new Date().getTime()));
order.setBianhao(new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
order.setShijian(new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()));
order.setZhuangtai("no");
order.setSonghuodizhi(songhuodizhi);
order.setFukuanfangshi(fukuanfangshi);
order.setJine(cart.getTotalPrice());
order.setUser_id(user.getId());
liuService.saveOrder(order);
for (Iterator it = cart.getItems().values().iterator(); it.hasNext();)
{
TorderItem orderItem = (TorderItem) it.next();
String id=String.valueOf(new Date().getTime());
String order_id=order.getId();
String goods_id=orderItem.getGoods().getId();
int goods_quantity=orderItem.getGoods_quantity();
liuService.saveOrderItem(id, order_id, goods_id, goods_quantity);
liuService.updateGoodsKucun(goods_id, goods_quantity);
}
cart.getItems().clear();
session.setAttribute("cart", cart);
req.setAttribute("order", order);
req.getRequestDispatcher("site/order/orderSubmit.jsp").forward(req, res);
}
public void myorder(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
HttpSession session=req.getSession();
Tuser user=(Tuser)session.getAttribute("user");
req.setAttribute("orderList", liuService.orderList(user.getId()));
req.getRequestDispatcher("site/order/myorder.jsp").forward(req, res);
}
public void orderDetail(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
String order_id=req.getParameter("order_id");
System.out.println(order_id+"DD");
req.setAttribute("orderItemList", liuService.orderItemList(order_id));
req.getRequestDispatcher("site/order/orderDetail.jsp").forward(req, res);
}
public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void destroy()
{
}
}
标签:Vue,java,String,rs,res,req,mydb,id,SpringBoot From: https://blog.csdn.net/m0_66863468/article/details/144305502源码获取:俺的博客首页 "资源" 里下载!