栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

SSM在线餐饮管理系统

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

SSM在线餐饮管理系统

作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

 

项目介绍

本项目包含管理员与普通用户两种角色;
管理员角色包含以下功能:
管理员登录,查看销售报表,餐桌管理,菜式管理,菜品管理,点餐明细管理,修改密码等功能。

用户角色包含以下功能:
用户登录,点餐,提交订单,修改密码等功能。
 

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 

5.数据库:MySql 5.7版本;

6.是否Maven项目:否;

技术栈

1. 后端:Spring+SpringMVC+Mybatis

2. 前端:JSP+CSS+JavaScript+jQuery+bootstrap

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

3. 将项目中WebContent/WEB-INF/config/config.properties配置文件中的数据库配置改为自己的配置;

4. 运行项目,在浏览器中输入 http://localhost:8080/ssm_restaurentsys/

运行截图 管理员角色

 

 

 

 

 

用户角色 

 

 

相关代码  BaseController
public abstract class BaseController {
	
	protected Map getWhereMap(HttpServletRequest request)
	{
		Map map = new HashMap();

		int start = StringUtil.parseToInt(request.getParameter("start"), 0);
		int limit = StringUtil.parseToInt(request.getParameter("limit"), 50);

		map.put("start", start);
		map.put("limit", limit);

		return map;
	}
	
	protected Map getMessageMap(boolean success, String message) {
		Map map = new HashMap();
		map.put("success", success);
		map.put("message", message);
		
		return map;
	}
}
DishController
@Controller
@RequestMapping(value="/dish")
public class DishController extends BaseController {
	
	@Autowired
	DishService dishService;
	
	@Autowired
	DishTypeService dishTypeService;
	
	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public String get(SearchVO searchVO, HttpServletRequest request, ModelMap modelMap) {
		String pageNow = request.getParameter("pageNow");
		Page page = null;

		Map whereMap = new HashMap();
		if (!StringUtil.isEmpty(searchVO.getName())) {
			whereMap.put("name", " name like '%" + searchVO.getName() + "%'");
		}

		int totalCount = (int) dishService.getCount(whereMap);

		if (pageNow != null) {
			page = new Page(totalCount, Integer.parseInt(pageNow));
		} else {
			page = new Page(totalCount, 1);
		}
		whereMap.put("startPos", page.getStartPos());
		whereMap.put("pageSize", page.getPageSize());
		
		List dishes = dishService.getAll(whereMap);

		modelMap.addAttribute("dishes", dishes);
		modelMap.addAttribute("page", page);
		
		return "restaurent/dishes";
	}

	@RequestMapping(value="/save", method = RequestMethod.POST)
	public String save(@RequestParam(required=false, value="file")MultipartFile file, Dishes dish, ModelMap modelMap, HttpSession session) {
		String path = dish.getPic();
		if (file != null && !file.isEmpty()) {
			String fileName = file.getOriginalFilename();
			String ext = fileName.substring(fileName.lastIndexOf("."));
			path = "/pic/" + System.currentTimeMillis() + ext;
			
			String dir = session.getServletContext().getRealPath(path);
			try {	
				FileUtils.copyInputStreamToFile(file.getInputStream(), new File(dir));
			} catch (IOException e) {
				e.printStackTrace();
			}
		} else if (StringUtil.isEmpty(path)){
			path = "/pic/default.jpg";
		}
		
        
        dish.setPic(path);
        
        DishType dishType = dishTypeService.getDishTypeById(dish.getDishType());
        dish.setTypeName(dishType.getName());
		
		if(dish.getId() == null) {
			dishService.insert(dish);
		} else {
			dishService.update(dish);
		}
		
		return "redirect:list.html";
	}
	
	@RequestMapping(value="/add", method = RequestMethod.GET)
	public String add(ModelMap modelMap) {
		List dishtypes = dishTypeService.getAll();
		
		modelMap.put("dishtypes", dishtypes);
		
		return "restaurent/adddish";
	}
	
	
	@RequestMapping(value="/update", method = RequestMethod.GET)
	public String update(int id, ModelMap modelMap) {
		Dishes dish = dishService.getDishesById(id);
		List dishtypes = dishTypeService.getAll();
		
		modelMap.put("dishtypes", dishtypes);
		modelMap.put("dish", dish);
		return "restaurent/adddish";
	}
	
	@RequestMapping(value="/delete", method = RequestMethod.GET)
	public String delete(int id, ModelMap modelMap) {
		dishService.deleteById(id);
		
		return "redirect:list.html";
	}
}

如果也想学习本系统,下面领取。回复:200ssm

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/996869.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号