基于java SpringBoot和Vue校园食堂网站管理系统毕业设计,附源码
摘要
本文旨在探讨一种基于Java Spring Boot和Vue框架的校园食堂网站管理系统的设计。首先,介绍了系统开发的背景及意义,即为了提高校园食堂的管理效率和改善学生的就餐体验。接着,详细阐述了系统的技术选型,包括后端采用Spring Boot框架以简化企业级应用开发,前端选用Vue框架以实现响应式界面和良好的用户体验。然后,描述了系统的主要功能模块,如用户管理、菜单浏览、在线点餐、支付结算等,并强调了其在数据处理和安全性方面的设计考虑。最后,总结了该系统的优势,如易于维护、扩展性强和用户友好等,同时也指出了未来改进的方向,如增加个性化推荐和优化用户交互设计。本研究对于推动校园食堂信息化建设具有一定的参考价值。
功能介绍
管理员、商家和学生三种用户角色;
管理员:个人中心、管理员管理、商家管理、用户管理、用户管理、食堂管理、美食管理、基础数据管理、论坛管理、新闻公告管理、轮播图管理等;
商家:个人中心、食堂管理、美食管理、论坛管理、新闻公告管理等;
学生:首页浏览、论坛交流、美食下单、公告查看、个人中心(地址管理、收藏管理评价管理、订单管理)等。
技术介绍
后端:Java语言的Spring Boot框架、MySQL数据库、Maven依赖管理等;
前端:Vue、element-ui、axios等。
部分代码展示
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
else if("商家".equals(role))
params.put("shangjiaId",request.getSession().getAttribute("userId"));
CommonUtil.checkMap(params);
PageUtils page = cartService.queryPage(params);
//字典表数据转换
List<CartView> list =(List<CartView>)page.getList();
for(CartView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
CartEntity cart = cartService.selectById(id);
if(cart !=null){
//entity转view
CartView view = new CartView();
BeanUtils.copyProperties( cart , view );//把实体数据重构到view中
//级联表 美食
//级联表
MeishiEntity meishi = meishiService.selectById(cart.getMeishiId());
if(meishi != null){
BeanUtils.copyProperties( meishi , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setMeishiId(meishi.getId());
}
//级联表 用户
//级联表
YonghuEntity yonghu = yonghuService.selectById(cart.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody CartEntity cart, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,cart:{}",this.getClass().getName(),cart.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
else if("用户".equals(role))
cart.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
Wrapper<CartEntity> queryWrapper = new EntityWrapper<CartEntity>()
.eq("yonghu_id", cart.getYonghuId())
.eq("meishi_id", cart.getMeishiId())
.eq("buy_number", cart.getBuyNumber())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
CartEntity cartEntity = cartService.selectOne(queryWrapper);
if(cartEntity==null){
cart.setCreateTime(new Date());
cart.setInsertTime(new Date());
cartService.insert(cart);
return R.ok();
}else {
return R.error(511,"商品已添加到购物车");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody CartEntity cart, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,cart:{}",this.getClass().getName(),cart.toString());
CartEntity oldCartEntity = cartService.selectById(cart.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
cart.setUpdateTime(new Date());
cartService.updateById(cart);//根据id更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<CartEntity> oldCartList =cartService.selectBatchIds(Arrays.asList(ids));//要删除的数据
cartService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
正文到此结束
- 本文标签: Java Spring Boot SSM
- 版权声明: 本站原创文章,于2024年10月15日由程序猿大波发布,转载请注明出处