基于javaweb的在线宠物商店系统(java+SSM+mysql+maven+tomcat)
一、项目简述
功能:本系统分用户前台和管理员后台。 系统包括用户的注册登录,狗狗的展示购物车添加以及下 单支付购买,后台有管理员用户,可以操作狗狗的品种, 狗狗的信息维护以及发货等等。 另外:系统采用MVC架构思想
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
/**
* 添加推荐
* @return
*/
@RequestMapping("/topSave")
public @ResponseBody String topSave(Tops tops,
@RequestParam(required=false, defaultValue="0")byte status,
@RequestParam(required=false, defaultValue="1") int page) {
int id = topService.add(tops);
return id > 0 ? "ok" : null;
}
/**
* 删除推荐
* @return
*/
@RequestMapping("/topDelete")
public @ResponseBody String topDelete(Tops tops,
@RequestParam(required=false, defaultValue="0")byte status,
@RequestParam(required=false, defaultValue="1") int page) {
boolean flag = topService.delete(tops);
return flag ? "ok" : null;
}
/**
* 类目列表
*
request.setAttribute("msg", "恭喜你! 登录成功了");
return "/admin/index.jsp";
}
/**
* 订单列表
*
* @return
*/
@RequestMapping("/orderList")
public String orderList(@RequestParam(required=false, defaultValue="0")byte status, HttpServletRequest request,
@RequestParam(required=false, defaultValue="1") int page) {
request.setAttribute("flag", 1);
request.setAttribute("status", status);
request.setAttribute("orderList", orderService.getList(status, page, rows));
request.setAttribute("pageTool", PageUtil.getPageTool(request, orderService.getTotal(status), page, rows));
return "/admin/order_list.jsp";
}
/**
* 订单发货
*
* @return
*/
user.setPassword(password);
userService.update(user);
return "redirect:userList?flag=2&page="+page;
}
/**
* 顾客更新
*
* @return
*/
@RequestMapping("/userEdit")
public String userEdit(int id, HttpServletRequest request) {
request.setAttribute("flag", 2);
request.setAttribute("user", userService.get(id));
return "/admin/user_edit.jsp";
}
/**
* 顾客更新
*
* @return
*/
@RequestMapping("/userUpdate")
public String userUpdate(Users user,
* 产品添加
*
* @return
* @throws Exception
*/
@RequestMapping("/goodSave")
public String goodSave(String name, int price, String intro, int stock, int typeId,
MultipartFile cover, MultipartFile image1, MultipartFile image2,
@RequestParam(required=false, defaultValue="1") int page) throws Exception {
Goods good = new Goods();
good.setName(name);
good.setPrice(price);
good.setIntro(intro);
*
* @return
*/
@RequestMapping("/goodAdd")
public String goodAdd(HttpServletRequest request) {
request.setAttribute("flag", 3);
request.setAttribute("typeList", typeService.getList());
return "/admin/good_add.jsp";
}
/**
* 产品添加
*
* @return
* @throws Exception
*/
@RequestMapping("/goodSave")
public String goodSave(String name, int price, String intro, int stock, int typeId,
MultipartFile cover, MultipartFile image1, MultipartFile image2,
@RequestParam(required=false, defaultValue="1") int page) throws Exception {
Goods good = new Goods();
good.setName(name);
}
/**
* 管理员列表
*
* @return
*/
@RequestMapping("/adminList")
public String adminList(HttpServletRequest request,
@RequestParam(required=false, defaultValue="1") int page) {
request.setAttribute("flag", 5);
request.setAttribute("adminList", adminService.getList(page, rows));
request.setAttribute("pageTool", PageUtil.getPageTool(request, adminService.getTotal(), page, rows));
return "/admin/admin_list.jsp";
}
/**
* 管理员修改自己密码
*
* @return
*/
@RequestMapping("/adminRe")
public String adminRe(HttpServletRequest request, HttpSession session) {
request.setAttribute("flag", 5);
request.setAttribute("admin", adminService.getByUsername(String.valueOf(session.getAttribute("username"))));
return "/admin/admin_reset.jsp";
}
/**
}
goodService.update(good);
return "redirect:goodList?flag=3&page="+page;
}
/**
* 产品删除
*
* @return
*/
@RequestMapping("/goodDelete")
public String goodDelete(int id,
@RequestParam(required=false, defaultValue="1") int page) {
goodService.delete(id);
return "redirect:goodList?flag=3&page="+page;
}
/**
* 添加推荐
* @return
*/
@RequestMapping("/topSave")
public @ResponseBody String topSave(Tops tops,
@RequestParam(required=false, defaultValue="0")byte status,
@RequestParam(required=false, defaultValue="1") int page) {
boolean flag = topService.delete(tops);
return flag ? "ok" : null;
}
/**
* 类目列表
*
* @return
*/
@RequestMapping("/typeList")
public String typeList(HttpServletRequest request) {
request.setAttribute("flag", 4);
request.setAttribute("typeList", typeService.getList());
return "/admin/type_list.jsp";
}
/**
* 类目添加
*
* @return
request.setAttribute("msg", "订单["+orderid+"]货到付款");
}
return "/index/payok.jsp";
}
/**
* 查看订单
* @return
*/
@RequestMapping("/order")
public String order(HttpSession session, Model model){
model.addAttribute("flag", 3);
model.addAttribute("typeList", typeService.getList());
Users user = (Users) session.getAttribute("user");
if (user == null) {
model.addAttribute("msg", "请登录后查看订单!");
return "/index/login.jsp";
}
List<Orders> orderList = orderService.getListByUserid(user.getId());
if (orderList!=null && !orderList.isEmpty()) {
for(Orders order : orderList){
order.setItemList(orderService.getItemList(order.getId()));
}
}
model.addAttribute("orderList", orderList);
/**
* 顾客更新
*
* @return
*/
@RequestMapping("/userUpdate")
public String userUpdate(Users user,
@RequestParam(required=false, defaultValue="1") int page) {
userService.update(user);
return "redirect:userList?flag=2&page="+page;
}
/**
* 顾客删除
*
* @return
*/
@RequestMapping("/userDelete")
public String userDelete(Users user,
@RequestParam(required=false, defaultValue="1") int page) {
userService.delete(user);
return "redirect:userList?flag=2&page="+page;
}
/**
* 产品列表
*
* @return
*/