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





基于javaweb的SSM茶叶售卖商城系统(java+ssm+jsp+easyui+mysql)
这是一个应用SSM框架的项目,前端页面整洁清晰。该系统有两个角色,一个是普通用户,另一个是管理员。
普通用户具有注册、登录、查看商品、添加购物车、添加商品收藏、下订单、商品评价、用户地址管理等等功能。
管理员具有登录、管理用户信息、管理商品信息、管理商品活动信息、管理订单信息、管理用户评论信息的等等功能。
应用技术:Jsp + SSM + EasyUi
运行环境:eclipse/IDEA + MySQL5.7 + Tomcat8.5 + JDK1.8
——————————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
| if(StringUtils.isEmpty(account.getEmail())){ ret.put("type", "error"); ret.put("msg", "请填写电子邮箱!"); return ret; } if(isExist(account.getUsername(), account.getId())){ ret.put("type", "error"); ret.put("msg", "该用户名已经存在,请重新输入!"); return ret; } if(accountService.edit(account) <= 0){ ret.put("type", "error"); ret.put("msg", "用户信息编辑失败,请联系管理员!"); return ret; } ret.put("type", "success"); ret.put("msg", "用户信息编辑成功!"); request.getSession().setAttribute("account", null); Account findByUsername = accountService.findByUsername(account.getUsername()); request.getSession().setAttribute("account", findByUsername); return ret; }
@RequestMapping(value="/edit_passwd",method=RequestMethod.POST) @ResponseBody public Map<String, String> edit_passwd(String pre_password,String new_password,String confirm_password,Account account, HttpServletRequest request){ Map<String, String> ret = new HashMap<String, String>(); if(StringUtils.isEmpty(pre_password)){ ret.put("type", "error"); ret.put("msg", "原密码不能为空!"); return ret; } if(StringUtils.isEmpty(new_password)){ ret.put("type", "error"); ret.put("msg", "新密码不能为空!"); return ret; } if(StringUtils.isEmpty(confirm_password)){
|
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 51
| @Autowired private LogService logService;
@RequestMapping(value="/index",method=RequestMethod.GET) public ModelAndView index(ModelAndView model,HttpServletRequest request){ List<Menu> userMenus = (List<Menu>)request.getSession().getAttribute("userMenus"); model.addObject("topMenuList", MenuUtil.getAllTopMenu(userMenus)); model.addObject("secondMenuList", MenuUtil.getAllSecondMenu(userMenus)); model.setViewName("system/index"); return model; }
@RequestMapping(value="/welcome",method=RequestMethod.GET) public ModelAndView welcome(ModelAndView model){ model.setViewName("system/welcome"); return model; }
@RequestMapping(value="/login",method=RequestMethod.GET) public ModelAndView login(ModelAndView model){ model.setViewName("system/login"); return model; }
@RequestMapping(value="/login",method=RequestMethod.POST) @ResponseBody public Map<String, String> loginAct(User user,String cpacha,HttpServletRequest request){ Map<String, String> ret = new HashMap<String, String>(); if(user == null){ ret.put("type", "error");
|
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
| return ret; } } package com.ischoolbar.programmer.controller.home;
@Controller @RequestMapping("/home") public class ShopLoginController {
@Autowired private AccountService accountService; @Autowired private LogService logService; @Autowired private ShoppingService shoppingService;
|
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
| ret.put("type", "error"); ret.put("msg", "验证码错误!"); return ret; }
if(isExist(account.getUsername(), 0l)){ ret.put("type", "error"); ret.put("msg", "该用户名已经存在,请重新输入!"); return ret; } account.setSex(0); account.setPhoto("../../resources/hohttps://yms-1257401191.cos.ap-nanjing.myqcloud.com/people.png"); if(accountService.add(account) <= 0){ ret.put("type", "error"); ret.put("msg", "用户添加失败,请联系管理员!"); return ret; } ret.put("type", "success"); ret.put("msg", "角色添加成功!"); return ret; }
private boolean isExist(String username,Long id){ Account account = accountService.findByUsername(username); if(account == null)return false; if(account.getId().longValue() == id.longValue())return false; return true; } } package com.ischoolbar.programmer.controller.admin;
|
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
| { ret.put("type", "error"); ret.put("msg", "添加购物车失败!请联系管理员!"); return ret; }else { ret.put("type", "success"); ret.put("msg", "添加购物车成功!"); return ret; } } }
@RequestMapping(value="/del_cart",method=RequestMethod.POST) @ResponseBody public Map<String, String> delete(String id,HttpServletRequest request){ Map<String, String> ret = new HashMap<String, String>(); if(id == null){ ret.put("type", "error"); ret.put("msg", "删除购物车商品失败!请联系管理员!"); return ret; } if(shoppingService.delete(id)==0) { ret.put("type", "error"); ret.put("msg", "删除购物车商品失败!请联系管理员!"); return ret; }else { ret.put("type", "success"); ret.put("msg", "删除购物车商品成功!"); return ret; } } } package com.ischoolbar.programmer.controller.home;
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=331422322105200km
https://javayms.pages.dev?id=331422322105200km