SpringBoot+Vue项目线上买菜系统源码展示

Phylicia ·
更新时间:2024-11-14
· 1331 次阅读

目录

系统展示

前台

商品信息

购物车

管理员功能

登录

首页

用户管理

商品分类管理

商品信息管理

订单管理

部分核心代码

开发语言:Java

框架:springboot

JDK版本:JDK1.8

服务器:tomcat7

数据库:mysql 5.7/8.0

数据库工具:Navicat11

开发软件:eclipse/myeclipse/idea

Maven包:Maven3.3.9

浏览器:谷歌浏览器

本线上买菜系统采用的数据库是Mysql,使用springboot框架开发。在设计过程中,充分保证了系统代码的良好可读性、实用性、易扩展性、通用性、便于后期维护、操作方便以及页面简洁等特点。

本系统主要包括管理员和用户两个角色组成,主要包括以下功能:

(1)前台:首页、商品信息、公告信息、个人中心、后台管理、购物车。

(2)管理员:首页、个人中心、用户管理、商品分类管理、商品信息管理、系统管理、订单管理。

(3)用户:首页、个人中心、修改密码、个人信息。

系统展示 前台

商品信息

购物车

管理员功能 登录

首页

用户管理

商品分类管理

商品信息管理

订单管理

部分核心代码 /** * 购物车表 * 后端接口 * @author * @email * @date 2022-04-27 10:29:38 */ @RestController @RequestMapping("/cart") public class CartController { @Autowired private CartService cartService; /** * 后端列表 */ @RequestMapping("/page") public R page(@RequestParam Map<String, Object> params,CartEntity cart, HttpServletRequest request){ if(!request.getSession().getAttribute("role").toString().equals("管理员")) { cart.setUserid((Long)request.getSession().getAttribute("userId")); } EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>(); PageUtils page = cartService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cart), params), params)); return R.ok().put("data", page); } /** * 前端列表 */ @IgnoreAuth @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params,CartEntity cart, HttpServletRequest request){ EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>(); PageUtils page = cartService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cart), params), params)); return R.ok().put("data", page); } /** * 列表 */ @RequestMapping("/lists") public R list( CartEntity cart){ EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>(); ew.allEq(MPUtil.allEQMapPre( cart, "cart")); return R.ok().put("data", cartService.selectListView(ew)); } /** * 查询 */ @RequestMapping("/query") public R query(CartEntity cart){ EntityWrapper< CartEntity> ew = new EntityWrapper< CartEntity>(); ew.allEq(MPUtil.allEQMapPre( cart, "cart")); CartView cartView = cartService.selectView(ew); return R.ok("查询购物车表成功").put("data", cartView); } /** * 后端详情 */ @RequestMapping("/info/{id}") public R info(@PathVariable("id") Long id){ CartEntity cart = cartService.selectById(id); return R.ok().put("data", cart); } /** * 前端详情 */ @IgnoreAuth @RequestMapping("/detail/{id}") public R detail(@PathVariable("id") Long id){ CartEntity cart = cartService.selectById(id); return R.ok().put("data", cart); } /** * 后端保存 */ @RequestMapping("/save") public R save(@RequestBody CartEntity cart, HttpServletRequest request){ cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); //ValidatorUtils.validateEntity(cart); cart.setUserid((Long)request.getSession().getAttribute("userId")); cartService.insert(cart); return R.ok(); } /** * 前端保存 */ @RequestMapping("/add") public R add(@RequestBody CartEntity cart, HttpServletRequest request){ cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); //ValidatorUtils.validateEntity(cart); cartService.insert(cart); return R.ok(); } /** * 修改 */ @RequestMapping("/update") @Transactional public R update(@RequestBody CartEntity cart, HttpServletRequest request){ //ValidatorUtils.validateEntity(cart); cartService.updateById(cart);//全部更新 return R.ok(); } /** * 删除 */ @RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ cartService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); } /** * 提醒接口 */ @RequestMapping("/remind/{columnName}/{type}") public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, @PathVariable("type") String type,@RequestParam Map<String, Object> map) { map.put("column", columnName); map.put("type", type); if(type.equals("2")) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); Date remindStartDate = null; Date remindEndDate = null; if(map.get("remindstart")!=null) { Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); c.setTime(new Date()); c.add(Calendar.DAY_OF_MONTH,remindStart); remindStartDate = c.getTime(); map.put("remindstart", sdf.format(remindStartDate)); } if(map.get("remindend")!=null) { Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); c.setTime(new Date()); c.add(Calendar.DAY_OF_MONTH,remindEnd); remindEndDate = c.getTime(); map.put("remindend", sdf.format(remindEndDate)); } } Wrapper<CartEntity> wrapper = new EntityWrapper<CartEntity>(); if(map.get("remindstart")!=null) { wrapper.ge(columnName, map.get("remindstart")); } if(map.get("remindend")!=null) { wrapper.le(columnName, map.get("remindend")); } if(!request.getSession().getAttribute("role").toString().equals("管理员")) { wrapper.eq("userid", (Long)request.getSession().getAttribute("userId")); } int count = cartService.selectCount(wrapper); return R.ok().put("count", count); } } /** * 商品信息 * 后端接口 * @author * @email * @date 2022-04-27 10:29:38 */ @RestController @RequestMapping("/shangpinxinxi") public class ShangpinxinxiController { @Autowired private ShangpinxinxiService shangpinxinxiService; @Autowired private StoreupService storeupService; /** * 后端列表 */ @RequestMapping("/page") public R page(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){ EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>(); PageUtils page = shangpinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinxinxi), params), params)); return R.ok().put("data", page); } /** * 前端列表 */ @IgnoreAuth @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){ EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>(); PageUtils page = shangpinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinxinxi), params), params)); return R.ok().put("data", page); } /** * 列表 */ @RequestMapping("/lists") public R list( ShangpinxinxiEntity shangpinxinxi){ EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>(); ew.allEq(MPUtil.allEQMapPre( shangpinxinxi, "shangpinxinxi")); return R.ok().put("data", shangpinxinxiService.selectListView(ew)); } /** * 查询 */ @RequestMapping("/query") public R query(ShangpinxinxiEntity shangpinxinxi){ EntityWrapper< ShangpinxinxiEntity> ew = new EntityWrapper< ShangpinxinxiEntity>(); ew.allEq(MPUtil.allEQMapPre( shangpinxinxi, "shangpinxinxi")); ShangpinxinxiView shangpinxinxiView = shangpinxinxiService.selectView(ew); return R.ok("查询商品信息成功").put("data", shangpinxinxiView); } /** * 后端详情 */ @RequestMapping("/info/{id}") public R info(@PathVariable("id") Long id){ ShangpinxinxiEntity shangpinxinxi = shangpinxinxiService.selectById(id); shangpinxinxi.setClicknum(shangpinxinxi.getClicknum()+1); shangpinxinxi.setClicktime(new Date()); shangpinxinxiService.updateById(shangpinxinxi); return R.ok().put("data", shangpinxinxi); } /** * 前端详情 */ @IgnoreAuth @RequestMapping("/detail/{id}") public R detail(@PathVariable("id") Long id){ ShangpinxinxiEntity shangpinxinxi = shangpinxinxiService.selectById(id); shangpinxinxi.setClicknum(shangpinxinxi.getClicknum()+1); shangpinxinxi.setClicktime(new Date()); shangpinxinxiService.updateById(shangpinxinxi); return R.ok().put("data", shangpinxinxi); } /** * 后端保存 */ @RequestMapping("/save") public R save(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){ shangpinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); //ValidatorUtils.validateEntity(shangpinxinxi); shangpinxinxiService.insert(shangpinxinxi); return R.ok(); } /** * 前端保存 */ @RequestMapping("/add") public R add(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){ shangpinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); //ValidatorUtils.validateEntity(shangpinxinxi); shangpinxinxiService.insert(shangpinxinxi); return R.ok(); } /** * 修改 */ @RequestMapping("/update") @Transactional public R update(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){ //ValidatorUtils.validateEntity(shangpinxinxi); shangpinxinxiService.updateById(shangpinxinxi);//全部更新 return R.ok(); } /** * 删除 */ @RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ shangpinxinxiService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); } /** * 提醒接口 */ @RequestMapping("/remind/{columnName}/{type}") public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, @PathVariable("type") String type,@RequestParam Map<String, Object> map) { map.put("column", columnName); map.put("type", type); if(type.equals("2")) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); Date remindStartDate = null; Date remindEndDate = null; if(map.get("remindstart")!=null) { Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); c.setTime(new Date()); c.add(Calendar.DAY_OF_MONTH,remindStart); remindStartDate = c.getTime(); map.put("remindstart", sdf.format(remindStartDate)); } if(map.get("remindend")!=null) { Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); c.setTime(new Date()); c.add(Calendar.DAY_OF_MONTH,remindEnd); remindEndDate = c.getTime(); map.put("remindend", sdf.format(remindEndDate)); } } Wrapper<ShangpinxinxiEntity> wrapper = new EntityWrapper<ShangpinxinxiEntity>(); if(map.get("remindstart")!=null) { wrapper.ge(columnName, map.get("remindstart")); } if(map.get("remindend")!=null) { wrapper.le(columnName, map.get("remindend")); } int count = shangpinxinxiService.selectCount(wrapper); return R.ok().put("count", count); } /** * 前端智能排序 */ @IgnoreAuth @RequestMapping("/autoSort") public R autoSort(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request,String pre){ EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>(); Map<String, Object> newMap = new HashMap<String, Object>(); Map<String, Object> param = new HashMap<String, Object>(); Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, Object> entry = it.next(); String key = entry.getKey(); String newKey = entry.getKey(); if (pre.endsWith(".")) { newMap.put(pre + newKey, entry.getValue()); } else if (StringUtils.isEmpty(pre)) { newMap.put(newKey, entry.getValue()); } else { newMap.put(pre + "." + newKey, entry.getValue()); } } params.put("sort", "clicknum"); params.put("order", "desc"); PageUtils page = shangpinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinxinxi), params), params)); return R.ok().put("data", page); } }

到此这篇关于SpringBoot+Vue项目线上买菜系统源码展示的文章就介绍到这了,更多相关SpringBoot vue商城内容请搜索软件开发网以前的文章或继续浏览下面的相关文章希望大家以后多多支持软件开发网!



VUE springboot 展示 系统 源码

需要 登录 后方可回复, 如果你还没有账号请 注册新账号