——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明







基于javaweb的SSM+Maven鞋子商城系统(java+ssm+jsp+layui+bootstrap+echarts+mysql)
项目介绍
本项目分为管理员与用户两种角色; 管理员角色包含以下功能: 管理员登录,商品管理,订单管理,人员管理,轮播图管理,评价管理,商品分类管理,修改管理员资料,修改密码等功能。
用户角色包含以下功能: 用户登录,查看首页,查看商品详情,查找商品,查看我的订单,修改密码,添加地址,查看购物车,确认下单 ,提交订单,修改个人资料等功能。
环境需要
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版本; 6.是否Maven项目:是;
技术栈
- 后端:Spring+SpringMVC+Mbytes 2. 前端:JSP+css+javascript+bootstrap+jQuery+layui+echarts
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中applicationContext.xml配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入localhost:8080/ssm_xiezishop
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| for (String s : id) { Integer goodsId = Integer.valueOf(s); rs = goodsService.deleteGoods(goodsId); } if(rs>0){ return "success"; }else{ return "fail"; } }
@RequestMapping(value="uploadImg",method={RequestMethod.POST}) @ResponseBody public Object uploadGoodsImg(@PathVariable(value="file")MultipartFile file,HttpServletRequest request){ String str = file.getOriginalFilename(); String name=UUIDUtil.getUUID()+str.substring(str.lastIndexOf(".")); String path=request.getSession().getServletContext().getRealPath("/upload")+"/"+name; try { file.transferTo(new File(path)); } catch (IllegalStateException | IOException e) { e.printStackTrace(); } JSONObject obj=new JSONObject(); obj.put("src", name); return obj; }
@RequestMapping("addGoods") @ResponseBody public String addGoods(Goods goods){ Integer rs = goodsService.addGoods(goods); if(rs>0){ return "success"; }else{ return "fail"; } } @RequestMapping("findGoodsByVolume") @ResponseBody public JSONObject findGoodsByVolume(){ List<Goods> goodsList = goodsService.findGoodsByVolume(5); String[] name=new String[5]; Integer[] volume=new Integer[5]; for(int i=0;i<goodsList.size();i++){ name[i]=goodsList.get(i).getGoodsName(); volume[i]=goodsList.get(i).getGoodsVolume(); } JSONObject obj=new JSONObject(); obj.put("name", name); obj.put("volume", volume);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| redisService.RefreshEvaluate(evaluate.getEvaGoods().getGoodsId()); if(rs<0){ flag=false; } } if(flag){ return "success"; }else{ return "fail"; } } @RequestMapping("deleteEvalute") @ResponseBody public String deleteEvalute(Integer evaId){ Evaluate evaluate = evaluateService.findEvaluteById(evaId); redisService.RefreshEvaluate(evaluate.getEvaGoods().getGoodsId()); Integer rs = evaluateService.deleteEvaluate(evaId); if(rs>0){ return "success"; }else{ return "fail"; } } @RequestMapping("findEvaById") @ResponseBody public Evaluate findEvaluateById(Integer evaId){ return evaluateService.findEvaluteById(evaId); } } package com.phonemarket.controller;
@Controller @RequestMapping("/goodsType") public class GoodsTypeController { @Autowired private IGoodsTypeService goodsTypeService;
@RequestMapping("findAll") @ResponseBody
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| return obj; } } package com.phonemarket.controller;
@Controller @RequestMapping("/user") public class UserController { private static final String String = null; @Autowired private IUserService userService; @RequestMapping("login") @ResponseBody public String login(String userName,String userPass,HttpServletRequest request){ Users user = userService.login(userName, MD5Utils.passToMD5(userPass)); if(user!=null){ HttpSession session = request.getSession(); session.setAttribute("user", user); return "success"; } return "fail";
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| public String logout(HttpServletRequest request){ HttpSession session = request.getSession(); session.removeAttribute("admin"); return "forward:/view/admin"; } @RequestMapping("updatePass") @ResponseBody public String updatePass(String oldPass,String newPass,HttpServletRequest request){ HttpSession session = request.getSession(); Admins admin = (Admins) session.getAttribute("admin"); if(oldPass.equals(admin.getAdminPass())){ admin.setAdminPass(newPass); adminService.updateAdmin(admin); session.removeAttribute("admin"); return "success"; } return "fail"; } } package com.phonemarket.interceptor;
public class UserLoginInterceptor implements HandlerInterceptor {
@Override public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3) throws Exception {
}
@Override public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, ModelAndView arg3) throws Exception {
}
@Override
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| public String batchDelete(String batchId){ String[] list = batchId.split(","); boolean flag=true; for (String s : list) { Integer evaId = Integer.valueOf(s); Evaluate evaluate = evaluateService.findEvaluteById(evaId); Integer rs = evaluateService.deleteEvaluate(evaId); redisService.RefreshEvaluate(evaluate.getEvaGoods().getGoodsId()); if(rs<0){ flag=false; } } if(flag){ return "success"; }else{ return "fail"; } } @RequestMapping("deleteEvalute") @ResponseBody public String deleteEvalute(Integer evaId){ Evaluate evaluate = evaluateService.findEvaluteById(evaId); redisService.RefreshEvaluate(evaluate.getEvaGoods().getGoodsId()); Integer rs = evaluateService.deleteEvaluate(evaId); if(rs>0){ return "success"; }else{ return "fail"; } } @RequestMapping("findEvaById") @ResponseBody public Evaluate findEvaluateById(Integer evaId){ return evaluateService.findEvaluteById(evaId); } } package com.phonemarket.controller;
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=241122542008200sm
https://javayms.pages.dev?id=241122542008200sm