package com.zt.controller;
import com.zt.pojo.cart;
import com.zt.pojo.custom;
import com.zt.pojo.goods;
import com.zt.pojo.order;
import com.zt.service.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
@Controller
public class BackstageController {
@Resource
private AdminService adminService;
@Resource
private GoodsService goodsService;
@Resource
private OrderService orderService;
@Resource
private CustomService customService;
@Resource
private CartService cartService;
// 管理员后台界面跳转
@RequestMapping(value = "/admin")
public ModelAndView toBackstage(){
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("page/alogin.jsp");
return modelAndView;
}
// 处理管理员登录
@RequestMapping(value = "/alogin.action",method = RequestMethod.POST)
public void alogin(@RequestParam(value = "cname") String cname,
@RequestParam(value = "password") String password,
HttpServletResponse response){
PrintWriter out = null;
try{
out = response.getWriter();
String result = adminService.loginService(cname,password);
out.print(result);
out.flush();
}catch (IOException e){
e.printStackTrace();
}finally {}
out.close();
}
// 添加商品信息
@RequestMapping(value = "/addGoods.action",method = RequestMethod.POST)
public void addGoods(@RequestParam(value = "id") String id,
@RequestParam(value = "img") String img,
@RequestParam(value = "title") String title,
@RequestParam(value = "info") String info,
@RequestParam(value = "name") String name,
@RequestParam(value = "price") String price,
@RequestParam(value = "stock") String stock,
@RequestParam(value = "para") String para,
@RequestParam(value = "type") String type,
@RequestParam(value = "weight") String weight,
HttpServletResponse response){
PrintWriter out = null;
try{
out = response.getWriter();
goods goods = new goods(id,img,title,info,name,new Integer(price),new Integer(stock),para,type,new Integer(weight));
goodsService.addGoodsService(goods);
out.print("success");
out.flush();
}catch (IOException e){
e.printStackTrace();
}finally {}
out.close();
}
// 添加订单信息
@RequestMapping(value = "/addOrder.action",method = RequestMethod.POST)
public void addOrder(@RequestParam(value = "rid") String rid,
@RequestParam(value = "cname") String cname,
@RequestParam(value = "ids") String ids,
@RequestParam(value = "names") String names,
@RequestParam(value = "price") String price,
HttpServletResponse response){
PrintWriter out = null;
try{
out = response.getWriter();
order order = new order(rid,cname,ids,names,new Integer(price));
orderService.addOrderService(order);
out.print("success");
out.flush();
}catch (IOException e){
e.printStackTrace();
}finally {}
out.close();
}
// 删除单个字段
@RequestMapping(value = "/deleteItem.action",method = RequestMethod.POST)
public void deleteItem1(@RequestParam("table") String table,
@RequestParam("id") String id,
HttpServletResponse response){
PrintWriter out = null;
try{
out = response.getWriter();
switch (table){
case "custom":{
customService.deleteCustomService(id);
break;
}
case "goods":{
goodsService.deleteGoodsService(id);
break;
}
case "cart":{
String[] s = id.split("_");
cartService.deleteCartService(s[0],s[1]);
break;
}
case "order":{
orderService.deleteOrderService(id);
break;
}
default:break;
}
out.print("success");
out.flush();
}catch (IOException e){
e.printStackTrace();
}finally {}
out.close();
}
// 修改客户信息
@RequestMapping(value = "/updateCustom2.action",method = RequestMethod.POST)
public void updateCustom2(@RequestParam(value = "cname") String cname,
@RequestParam(value = "name") String name,
@RequestParam(value = "phone") String phone,
@RequestParam(value = "address") String address,
@RequestParam(value = "password") String password,
@RequestParam(value = "question") String question,
@RequestParam(value = "answer") String answer,
HttpServletResponse response){
PrintWriter out = null;
try{
out = response.getWriter();
custom c = new custom(cname,password,name,phone,address,question,answer);
customService.updateCustomService(c);
out.print("success");
out.flush();
}catch (IOException e){
e.printStackTrace();
}finally {}
out.close();
}
// 修改商品信息
@RequestMapping(value = "/updateGoods.action",method = RequestMethod.POST)
public void updateGoods(@RequestParam(value = "id") String id,
@RequestParam(value = "img") String img,
@RequestParam(value = "title") String title,
@RequestParam(value = "info") String info,
@RequestParam(value = "name") String name,
@RequestParam(value = "price") String price,
@RequestParam(value = "stock") String stock,
@RequestParam(value = "para") String para,
@RequestParam(value = "type") String type,
@RequestParam(value = "weight") String weight,
HttpServletResponse response){
PrintWriter out = null;
try{
out = response.getWriter();
goods goods = new goods(id,img,title,info,name,new Integer(price),new Integer(stock),para,type,new Integer(weight));
goodsService.updateGoodsService(goods);
out.print("success");
out.flush();
}catch (IOException e){
e.printStackTrace();
}finally {}
out.close();
}
// 修改购物车信息
@RequestMapping(value = "/updateCart.action",method = RequestMethod.POST)
public void updateCart(@RequestParam(value = "cname") String cname,
@RequestParam(value = "id") String id,
@RequestParam(value = "img") String img,
@RequestParam(value = "name") String name,
没有合适的资源?快使用搜索试试~ 我知道了~
基于ssm框架的购物系统.zip
共360个文件
jpg:76个
xml:67个
java:54个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 53 浏览量
2023-07-08
16:05:37
上传
评论
收藏 39.82MB ZIP 举报
温馨提示
基于ssm写的系统(含数据库文件) 语言:java 框架:ssm 数据库:mysql
资源推荐
资源详情
资源评论
收起资源包目录
基于ssm框架的购物系统.zip (360个子文件)
bootstrap.css 143KB
bootstrap.min.css 118KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
background.css 4KB
register.css 3KB
goods.css 2KB
login.css 2KB
goodsList.css 1KB
type.css 1KB
myinfo.css 986B
index.css 939B
paydialog.css 795B
astyle.css 715B
aindex.css 532B
forget.css 526B
payment.css 398B
myorder.css 328B
alogin.css 273B
mycart.css 256B
glyphicons-halflings-regular.eot 20KB
timg.gif 4KB
prompt.html 6KB
aprompt2.html 5KB
aprompt1.html 4KB
aprompt3.html 4KB
aprompt4.html 3KB
index.html 3KB
register.html 3KB
aindex.html 2KB
agoods.html 2KB
goodsList.html 2KB
acustom.html 2KB
payment.html 2KB
acart.html 1KB
arecommend.html 1KB
aorder.html 1KB
admin.html 1KB
mycart.html 1KB
asort.html 1KB
myinfo.html 1KB
user.html 1KB
type.html 1KB
goods.html 1KB
myorder.html 1KB
forget2.html 1023B
forget1.html 947B
forget3.html 938B
login.html 888B
recommend.html 774B
head.html 660B
alogin.html 659B
jstl.html 326B
menu.html 325B
search.html 321B
nav.html 297B
foot.html 253B
atop.html 215B
title.html 141B
subtitle.html 141B
shop-web.iml 5KB
shop-controller.iml 5KB
shop-dao.iml 5KB
shop-service.iml 5KB
shop-manager.iml 5KB
ShopProject.iml 830B
BackstageController.java 9KB
PageCreateController.java 8KB
OperationController.java 5KB
VerificationController.java 5KB
NumberUtil.java 2KB
goods.java 2KB
CustomServiceImpl.java 2KB
custom.java 2KB
OrderServiceImpl.java 2KB
PayUtil.java 2KB
CartServiceImpl.java 2KB
cart.java 2KB
GoodsServiceImpl.java 2KB
RecommendServiceImpl.java 1KB
recommend.java 1KB
order.java 1KB
pay.java 1KB
ExecutorTest.java 1KB
admin.java 1KB
orderv.java 1KB
GoodsListServiceImpl.java 1KB
goodsindex.java 1KB
sort.java 1KB
FileUtil.java 1KB
InitController.java 925B
GoodsIndexServiceImpl.java 895B
SortServiceImpl.java 829B
JsonUtil.java 725B
AdminServiceImpl.java 705B
GoodsDao.java 685B
NumberTest.java 673B
CustomService.java 614B
CustomDao.java 528B
TypeUtil.java 495B
共 360 条
- 1
- 2
- 3
- 4
资源评论
我慢慢地也过来了
- 粉丝: 6295
- 资源: 3956
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功