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





基于javaweb的SSM+Maven在线点餐系统(java+ssm+jsp+mysql+maven+layui)
一、项目简述
功能包括: 前台实现:用户浏览菜单、菜品分类筛选、查看菜单详 情、添加购物车、购物车结算、会员券、个人订单查询等 等。 后台实现:餐系管理、菜品管理、订单管理、系统管理、 酉己备员管理等。 系统分为:高或管理员、顾客、厨师、配送员等等。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。
——————————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 51 52
| AddressEntity address = addressMapper.selectDefaultedAddressByUserId(vo.getUserId()); if (addressMapper.addAddress(vo) > 0){ if (vo.getDefaulted()==1 && address!=null) { addressMapper.modifyAddressUndefaulted(address.getAddressId()); } map.put(SystemConstant.FLAG, true); map.put(SystemConstant.MESSAGE, "地址新增成功"); }else { map.put(SystemConstant.FLAG, true); map.put(SystemConstant.MESSAGE, "地址新增失败"); } return map; }
@Override public Map<String, Object> modifyAddress(AddressVo vo, HttpSession session) { vo.setUserId(((UserEntity) session.getAttribute(SystemConstant.USERLOGIN)).getUserId()); Map<String, Object> map = new HashMap<>(16); AddressEntity address = addressMapper.selectDefaultedAddressByUserId(vo.getUserId()); if (addressMapper.modifyAddress(vo) > 0) { if (vo.getDefaulted()==1 && address!=null) { addressMapper.modifyAddressUndefaulted(address.getAddressId()); } map.put(SystemConstant.FLAG, true); map.put(SystemConstant.MESSAGE, "地址修改成功"); }else { map.put(SystemConstant.FLAG, true); map.put(SystemConstant.MESSAGE, "地址修改失败"); } return map; }
@Override public Map<String, Object> deleteAddress(Long addressId) { Map<String, Object> map = new HashMap<>(16); if (addressMapper.deleteAddress(addressId) > 0) { map.put(SystemConstant.FLAG, true); map.put(SystemConstant.MESSAGE, "地址删除成功");
|
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
| * @param vo * @return */ @Override public LayuiTableDataResult findAddressListByUserId(AddressVo vo) { PageHelper.startPage(vo.getPage(), vo.getLimit()); List<AddressEntity> addressList = addressMapper.findAddressListByUserId(vo); PageInfo<AddressEntity> pageInfo = new PageInfo<>(addressList); return new LayuiTableDataResult(pageInfo.getTotal(), pageInfo.getList()); }
@Override public Map<String, Object> addAddress(AddressVo vo, HttpSession session) { vo.setUserId(((UserEntity) session.getAttribute(SystemConstant.USERLOGIN)).getUserId()); Map<String, Object> map = new HashMap<>(16); AddressEntity address = addressMapper.selectDefaultedAddressByUserId(vo.getUserId()); if (addressMapper.addAddress(vo) > 0){ if (vo.getDefaulted()==1 && address!=null) { addressMapper.modifyAddressUndefaulted(address.getAddressId()); } map.put(SystemConstant.FLAG, true); map.put(SystemConstant.MESSAGE, "地址新增成功"); }else { map.put(SystemConstant.FLAG, true); map.put(SystemConstant.MESSAGE, "地址新增失败"); } return map; }
@Override public Map<String, Object> modifyAddress(AddressVo vo, HttpSession session) { vo.setUserId(((UserEntity) session.getAttribute(SystemConstant.USERLOGIN)).getUserId());
|
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
| } else { map.put(SystemConstant.FLAG, false); map.put(SystemConstant.MESSAGE, "【" + vo.getTitle() + "】菜单信息修改失败"); } return map; }
@Override public Map<String, Object> deleteMenu(Integer menuId) { Map<String, Object> map = new HashMap<>(16); if (menuMapper.countRoleByMenuId(menuId) == 0){ menuMapper.deleteMenu(menuId); map.put(SystemConstant.FLAG, true); map.put(SystemConstant.MESSAGE, "菜单删除成功"); }else { map.put(SystemConstant.FLAG, false); map.put(SystemConstant.MESSAGE, "仍有角色拥有该菜单的使用权限,删除失败"); } return map; }
} package edu.jmu.sudi.service.impl;
|
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
| order.setRealName(((String) map.get("realName"))); order.setPhone(((String) map.get("phone"))); if (map.get("ticketId")!=null && ((String) map.get("ticketId"))!=""){ order.setTicketId(Long.parseLong((String) map.get("ticketId"))); order.setCheap(ticketMapper.findTicketById(Long.parseLong((String) map.get("ticketId"))).getCheap()); } List<ShopcartEntity> shopcart = shopcartMapper.findAllShopcartByUserId(order.getUserId());
try { if (orderMapper.generateOrder(order) <= 0) { throw new RuntimeException(); } Integer totalCount = 0; BigDecimal totalPrice = new BigDecimal(0); for (ShopcartEntity item : shopcart) { OrderDetailEntity orderDetail = new OrderDetailEntity(); orderDetail.setSkuId(item.getSkuId()); orderDetail.setOrderId(order.getOrderId()); orderDetail.setAmount(item.getNumCount()); orderDetail.setItemPrice(item.getSkuPrice().multiply(new BigDecimal(item.getNumCount()))); totalCount += orderDetail.getAmount(); totalPrice = totalPrice.add(orderDetail.getItemPrice());
FoodSkuEntity foodSku = foodSkuMapper.findFoodSkuBySkuId(item.getSkuId()); if (orderDetailMapper.generateOrderDetail(orderDetail) <= 0 || foodMapper.addSaleCount(foodSku.getFoodId(), item.getNumCount()) <= 0 || foodSkuMapper.addSkuSale(item.getSkuId(), item.getNumCount()) <= 0){ throw new RuntimeException();
|
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
|
@RestController @RequestMapping("/backstage/food") public class FoodManageController {
@Autowired private FoodService foodService;
@RequestMapping("/list") public String findFoodListByPage(FoodVo vo){ LayuiTableDataResult foodListByPage = foodService.findFoodListByPage(vo); return JSON.toJSONString(foodListByPage); }
@RequestMapping("/uploadFile") public String uploadFile(MultipartFile foodImage) { Map<String, Object> map = foodService.uploadFile(foodImage); return JSON.toJSONString(map); }
@RequestMapping("/add") public String addFood(@RequestParam String mapStr, FoodVo vo, HttpSession session) {
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=011422282105200cc
https://javayms.pages.dev?id=011422282105200cc