【计算机毕业设计】餐厅点菜管理系统

餐厅点菜管理系统的设计与实现
网络技术和计算机技术发展至今,已经拥有了深厚的理论基础,并在现实中进行了充分运用,尤其是基于计算机运行的软件更是受到各界的关注。加上现在人们已经步入信息时代,所以对于信息的宣传和管理就很关键。因此餐厅点菜信息的管理计算机化,系统化是必要的。设计开发餐厅点菜管理系统不仅会节约人力和管理成本,还会安全保存庞大的数据量,对于餐厅点菜信息的维护和检索也不需要花费很多时间,非常的便利。
餐厅点菜管理系统是在MySQL中建立数据表保存信息,运用Vue框架和Java语言编写。并按照软件设计开发流程进行设计实现。系统具备友好性且功能完善。其管理员管理食物库存,菜品信息,管理预订和未预定餐桌,管理店内订单流水以及外卖订单。用户查看餐厅资讯,收藏菜品,下单购买菜品,查看外卖订单,用户也可以在餐厅内预订餐桌,对菜品进行点餐,查看店内订单记录。
餐厅点菜管理系统在让餐厅点菜信息规范化的同时,也能及时通过数据输入的有效性规则检测出错误数据,让数据的录入达到准确性的目的,进而提升餐厅点菜管理系统提供的数据的可靠性,让系统数据的错误率降至最低。
Java SSM餐厅点餐系统,后端基于SSM框架进行开发,前端页面效果通过使用vue进行编码实现,主要将实现用户跟管理员角色,实现了菜品展示管理、外卖订单管理等功能。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

package com.controller;

import java.util.*;
import javax.servlet.http.HttpServletRequest;

import com.entity.YudingcanzhuoEntity;
import com.service.YudingcanzhuoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

import com.entity.CanzhuoEntity;

import com.service.CanzhuoService;
import com.utils.PageUtils;
import com.utils.R;

/**
 * 餐桌表
 * 后端接口
 * @author
 * @email
 * @date 2021-03-08
*/
@RestController
@Controller
@RequestMapping("/canzhuo")
public class CanzhuoController {
    private static final Logger logger = LoggerFactory.getLogger(CanzhuoController.class);

    @Autowired
    private CanzhuoService canzhuoService;

    @Autowired
    private YudingcanzhuoService yudingcanzhuoService;

    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params){
        logger.debug("Controller:"+this.getClass().getName()+",page方法");
        PageUtils page = canzhuoService.queryPage(params);
        return R.ok().put("data", page);
    }
    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        logger.debug("Controller:"+this.getClass().getName()+",info方法");
        CanzhuoEntity canzhuo = canzhuoService.selectById(id);
        if(canzhuo!=null){
            return R.ok().put("data", canzhuo);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody CanzhuoEntity canzhuo, HttpServletRequest request){
        logger.debug("Controller:"+this.getClass().getName()+",save");
        Wrapper<CanzhuoEntity> queryWrapper = new EntityWrapper<CanzhuoEntity>()
            .eq("name", canzhuo.getName())
            .eq("tableLocation", canzhuo.getTableLocation())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CanzhuoEntity canzhuoEntity = canzhuoService.selectOne(queryWrapper);
        if(canzhuoEntity==null){
            canzhuo.setSfTypes(2);
            canzhuoService.insert(canzhuo);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody CanzhuoEntity canzhuo, HttpServletRequest request){
        logger.debug("Controller:"+this.getClass().getName()+",update");
        //根据字段查询是否有相同数据
        Wrapper<CanzhuoEntity> queryWrapper = new EntityWrapper<CanzhuoEntity>()
            .notIn("id",canzhuo.getId())
            .eq("name", canzhuo.getName())
            .eq("tableLocation", canzhuo.getTableLocation())
            .eq("sf_types", canzhuo.getSfTypes())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CanzhuoEntity canzhuoEntity = canzhuoService.selectOne(queryWrapper);
        if(canzhuoEntity==null){
            canzhuoService.updateById(canzhuo);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        logger.debug("Controller:"+this.getClass().getName()+",delete");
        canzhuoService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }

    /**
    * 预定
    */
    @RequestMapping("/subscribe")
    public R subscribe(Integer ids, HttpServletRequest request){
        CanzhuoEntity canzhuoEntity = canzhuoService.selectById(ids);
        if(canzhuoEntity == null){
           return R.error();
        }
        canzhuoEntity.setSfTypes(1);
        canzhuoService.updateById(canzhuoEntity);
        YudingcanzhuoEntity yudingcanzhuoEntity = new YudingcanzhuoEntity();
        yudingcanzhuoEntity.setCreateTime(new Date());
        yudingcanzhuoEntity.setCzTypes(canzhuoEntity.getId());
        yudingcanzhuoEntity.setYhTypes((Integer) request.getSession().getAttribute("userId"));
        yudingcanzhuoService.insert(yudingcanzhuoEntity);
        return R.ok();
    }
}


package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;

import com.entity.OrdersEntity;
import com.entity.view.OrdersView;

import com.service.OrdersService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.CommonUtil;


/**
 * 订单
 * 后端接口
 * @author 
 * @email 
 * @date 2021-01-25 11:41:44
 */
@RestController
@RequestMapping("/orders")
public class OrdersController {
    @Autowired
    private OrdersService ordersService;
    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,OrdersEntity orders, HttpServletRequest request){
    	if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
    		orders.setUserid((Integer)request.getSession().getAttribute("userId"));
    	}

        EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
		PageUtils page = ordersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, orders), params), params));
        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,OrdersEntity orders, HttpServletRequest request){
        EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
		PageUtils page = ordersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, orders), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( OrdersEntity orders){
       	EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
      	ew.allEq(MPUtil.allEQMapPre( orders, "orders")); 
        return R.ok().put("data", ordersService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(OrdersEntity orders){
        EntityWrapper< OrdersEntity> ew = new EntityWrapper< OrdersEntity>();
 		ew.allEq(MPUtil.allEQMapPre( orders, "orders")); 
		OrdersView ordersView =  ordersService.selectView(ew);
		return R.ok("查询订单成功").put("data", ordersView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        OrdersEntity orders = ordersService.selectById(id);
        return R.ok().put("data", orders);
    }

    /**
     * 前端详情
     */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        OrdersEntity orders = ordersService.selectById(id);
        return R.ok().put("data", orders);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody OrdersEntity orders, HttpServletRequest request){
    	orders.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(orders);
    	orders.setUserid((Integer)request.getSession().getAttribute("userId"));

        ordersService.insert(orders);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody OrdersEntity orders, HttpServletRequest request){
    	orders.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(orders);

        ordersService.insert(orders);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody OrdersEntity orders, HttpServletRequest request){
        //ValidatorUtils.validateEntity(orders);
        ordersService.updateById(orders);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        ordersService.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<OrdersEntity> wrapper = new EntityWrapper<OrdersEntity>();
		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 = ordersService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	


}

package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import com.entity.KuchuenEntity;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;

import com.entity.StoreupEntity;
import com.entity.view.StoreupView;

import com.service.StoreupService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.CommonUtil;


/**
 * 收藏表
 * 后端接口
 * @author 
 * @email 
 * @date 2021-01-25 11:41:44
 */
@RestController
@RequestMapping("/storeup")
public class StoreupController {
    @Autowired
    private StoreupService storeupService;
    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,StoreupEntity storeup, HttpServletRequest request){
    	if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
            //String userId = (String) request.getSession().getAttribute("userId");
            //Integer i = Integer.parseInt(userId);
            storeup.setUserid((Integer) request.getSession().getAttribute("userId"));
    	}

        EntityWrapper<StoreupEntity> ew = new EntityWrapper<StoreupEntity>();
		PageUtils page = storeupService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, storeup), params), params));
        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,StoreupEntity storeup, HttpServletRequest request){
    	if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
    		storeup.setUserid((Integer) request.getSession().getAttribute("userId"));
    	}

        EntityWrapper<StoreupEntity> ew = new EntityWrapper<StoreupEntity>();
		PageUtils page = storeupService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, storeup), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( StoreupEntity storeup){
       	EntityWrapper<StoreupEntity> ew = new EntityWrapper<StoreupEntity>();
      	ew.allEq(MPUtil.allEQMapPre( storeup, "storeup")); 
        return R.ok().put("data", storeupService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(StoreupEntity storeup){
        EntityWrapper< StoreupEntity> ew = new EntityWrapper< StoreupEntity>();
 		ew.allEq(MPUtil.allEQMapPre( storeup, "storeup")); 
		StoreupView storeupView =  storeupService.selectView(ew);
		return R.ok("查询收藏表成功").put("data", storeupView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        StoreupEntity storeup = storeupService.selectById(id);
        return R.ok().put("data", storeup);
    }

    /**
     * 前端详情
     */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        StoreupEntity storeup = storeupService.selectById(id);
        return R.ok().put("data", storeup);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody StoreupEntity storeup, HttpServletRequest request){
    	storeup.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
        Wrapper<StoreupEntity> queryWrapper = new EntityWrapper<StoreupEntity>()
                .eq("refid", storeup.getRefid())
                .eq("userid", storeup.getUserid())
                ;
        StoreupEntity storeupEntity = storeupService.selectOne(queryWrapper);
        if(storeupEntity != null){
            return R.error("你已经收藏过了");
        }
    	storeup.setUserid((Integer) request.getSession().getAttribute("userId"));

        storeupService.insert(storeup);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody StoreupEntity storeup, HttpServletRequest request){
    	storeup.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
        Wrapper<StoreupEntity> queryWrapper = new EntityWrapper<StoreupEntity>()
                .eq("refid", storeup.getRefid())
                .eq("userid", storeup.getUserid())
                ;
        StoreupEntity storeupEntity = storeupService.selectOne(queryWrapper);
        if(storeupEntity != null){
            return R.error("你已经收藏过了");
        }
    	storeup.setUserid((Integer)request.getSession().getAttribute("userId"));

        storeupService.insert(storeup);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody StoreupEntity storeup, HttpServletRequest request){
        //ValidatorUtils.validateEntity(storeup);
        storeupService.updateById(storeup);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        storeupService.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<StoreupEntity> wrapper = new EntityWrapper<StoreupEntity>();
		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 = storeupService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	


}

package com.controller;

import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;

import com.entity.CanzhuoEntity;
import com.service.CanzhuoService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

import com.entity.YudingcanzhuoEntity;

import com.service.YudingcanzhuoService;
import com.utils.PageUtils;
import com.utils.R;

/**
 * 预定餐桌表
 * 后端接口
 * @author
 * @email
 * @date 2021-03-08
*/
@RestController
@Controller
@RequestMapping("/yudingcanzhuo")
public class YudingcanzhuoController {
    private static final Logger logger = LoggerFactory.getLogger(YudingcanzhuoController.class);

    @Autowired
    private CanzhuoService canzhuoService;

    @Autowired
    private YudingcanzhuoService yudingcanzhuoService;

    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("Controller:"+this.getClass().getName()+",page方法");
        PageUtils page = null;
        if(!request.getSession().getAttribute("role").equals("管理员")){
            params.put("yh",request.getSession().getAttribute("userId"));
            page = yudingcanzhuoService.queryPage(params);
        }else{
            page = yudingcanzhuoService.queryPage(params);
        }
        return R.ok().put("data", page);
    }
    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        logger.debug("Controller:"+this.getClass().getName()+",info方法");
        YudingcanzhuoEntity yudingcanzhuo = yudingcanzhuoService.selectById(id);
        if(yudingcanzhuo!=null){
            return R.ok().put("data", yudingcanzhuo);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody YudingcanzhuoEntity yudingcanzhuo, HttpServletRequest request){
        logger.debug("Controller:"+this.getClass().getName()+",save");
        Wrapper<YudingcanzhuoEntity> queryWrapper = new EntityWrapper<YudingcanzhuoEntity>()
            .eq("cz_types", yudingcanzhuo.getCzTypes())
            .eq("yh_types", yudingcanzhuo.getYhTypes())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        YudingcanzhuoEntity yudingcanzhuoEntity = yudingcanzhuoService.selectOne(queryWrapper);
        if(yudingcanzhuoEntity==null){
            yudingcanzhuoService.insert(yudingcanzhuo);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody YudingcanzhuoEntity yudingcanzhuo, HttpServletRequest request){
        logger.debug("Controller:"+this.getClass().getName()+",update");
        //根据字段查询是否有相同数据
        Wrapper<YudingcanzhuoEntity> queryWrapper = new EntityWrapper<YudingcanzhuoEntity>()
            .notIn("id",yudingcanzhuo.getId())
            .eq("cz_types", yudingcanzhuo.getCzTypes())
            .eq("yh_types", yudingcanzhuo.getYhTypes())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        YudingcanzhuoEntity yudingcanzhuoEntity = yudingcanzhuoService.selectOne(queryWrapper);
        if(yudingcanzhuoEntity==null){
            yudingcanzhuoService.updateById(yudingcanzhuo);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    //canzhuoService

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(Integer ids){
        YudingcanzhuoEntity yudingcanzhuoEntity = yudingcanzhuoService.selectById(ids);
        if(yudingcanzhuoEntity == null){
            return R.error();
        }
        CanzhuoEntity canzhuoEntity = canzhuoService.selectById(yudingcanzhuoEntity.getCzTypes());
        if(canzhuoEntity == null){
            return R.error();
        }
        canzhuoEntity.setSfTypes(2);
        canzhuoService.updateById(canzhuoEntity);
        yudingcanzhuoService.deleteById(ids);
        return R.ok();
    }
}


  • 2
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
一个简单的点菜系统可以分为以下几个部分: 1. 菜单:包括菜品名称、价格等信息。 2. 订单:记录顾客所点的菜品和数量。 3. 结算:计算订单总价并输出。 下面是一个简单的C++实现: ```c++ #include <iostream> #include <vector> using namespace std; // 菜单项 struct MenuItem { string name; double price; }; // 订单项 struct OrderItem { string name; int quantity; }; int main() { vector<MenuItem> menu = {{"鱼香肉丝", 25.0}, {"宫保鸡丁", 30.0}, {"麻婆豆腐", 20.0}, {"清蒸鲈鱼", 50.0}}; vector<OrderItem> order; while (true) { // 输出菜单 cout << "======================" << endl; cout << " 菜单" << endl; cout << "======================" << endl; for (int i = 0; i < menu.size(); i++) { cout << i + 1 << ". " << menu[i].name << " " << menu[i].price << "元" << endl; } // 选择菜品 cout << "请选择菜品(输入0结束选择):" << endl; int choice; cin >> choice; if (choice == 0) { break; } if (choice < 1 || choice > menu.size()) { cout << "选择无效,请重新选择!" << endl; continue; } // 输入数量 cout << "请输入数量:" << endl; int quantity; cin >> quantity; if (quantity < 1) { cout << "数量无效,请重新输入!" << endl; continue; } // 添加到订单中 OrderItem item = {menu[choice - 1].name, quantity}; order.push_back(item); cout << "已添加到订单中!" << endl; } // 输出订单 if (order.size() == 0) { cout << "订单为空!" << endl; return 0; } cout << "======================" << endl; cout << " 订单" << endl; cout << "======================" << endl; double total = 0.0; for (int i = 0; i < order.size(); i++) { cout << order[i].name << " x " << order[i].quantity << " = " << menu[i].price * order[i].quantity << "元" << endl; total += menu[i].price * order[i].quantity; } cout << "总价:" << total << "元" << endl; return 0; } ``` 该程序使用了vector来存储菜单和订单信息,并使用了结构体来表示菜单项和订单项。用户可以通过选择菜品和输入数量来将菜品加入到订单中,然后程序会计算订单总价并输出。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JAVA编码选手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值