——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Tomcat≥8
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM员工订餐系统(java+ssm+jsp+jquery+mysql)
项目介绍
本项目分为前后台,前台为普通用户登录,后台为管理员登录;
用户角色包含以下功能: 用户登录与注册,查看首页,查看菜品详情,查看购物车,提交订单,查看订单,修改个人信息等功能。
管理员角色包含以下功能: 管理员登录,员工信息管理,菜品信息管理,订单信息管理等功能。
环境需要
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项目:否;
技术栈
后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+jQuery
使用说明
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入http://localhost:8080/ 登录
——————————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 } else { maxPage = maxPage / 12 + 1; } if (number == null) { number = "0"; } int start = Integer.parseInt(number) * 12; int over = (Integer.parseInt(number) + 1) * 12; int count = pageNumber - over; if (count <= 0) { over = pageNumber; } for (int i = start; i < over; i++) { Article x = tempList.get(i); articleList.add(x); } String html = ""; StringBuffer buffer = new StringBuffer(); buffer.append(" 共为"); buffer.append(maxPage); buffer.append("页 共有"); buffer.append(pageNumber); buffer.append("条 当前为第"); buffer.append((Integer.parseInt(number) + 1)); buffer.append("页 "); if ((Integer.parseInt(number) + 1) == 1) { buffer.append("首页"); } else { buffer.append("<a href =\ "index /article.action ?number =0\ "> 首页</a > "); } buffer.append(" "); if ((Integer.parseInt(number) + 1) == 1) { buffer.append("上一页"); } else { buffer.append("<a href =\ "index /article.action ?number =" + (Integer.parseInt(number) - 1) + " \"> 上一页</a > "); } buffer.append(" "); if (maxPage <= (Integer.parseInt(number) + 1)) { buffer.append("下一页"); } else {
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 this .getSession().setAttribute("username" , users.getUsername()); this .getSession().setAttribute("users" , users); return "redirect:/index/index.action" ; } else { this .getSession().setAttribute("message" , "密码错误" ); return "redirect:/index/preLogin.action" ; } } } @RequestMapping("preReg.action") public String preReg () { this .front(); return "users/register" ; } @RequestMapping("register.action") public String register (Users users) { this .front(); Users u = new Users(); u.setUsername(users.getUsername()); List<Users> usersList = this .usersService.getUsersByCond(u); if (usersList.size() == 0 ) { users.setRegdate(VeDate.getStringDateShort()); this .usersService.insertUsers(users); } else { this .getSession().setAttribute("message" , "用户名已存在" ); return "redirect:/index/preReg.action" ; } return "redirect:/index/preLogin.action" ; } @RequestMapping("exit.action") public String exit () { this .front(); this .getSession().removeAttribute("userid" ); this .getSession().removeAttribute("username" ); this .getSession().removeAttribute("users" ); return "index" ; } @RequestMapping("prePwd.action") public String prePwd () { this .front(); if (this .getSession().getAttribute("userid" ) == null ) {
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 PageHelper.getPage(this .cityService.getCityByLike(city), "city" , nameList, valueList, 10 , number, this .getRequest(), "query" ); name = null ; cond = null ; return "admin/querycity" ; } @RequestMapping("getCityById.action") public String getCityById (String id) { City city = this .cityService.getCityById(id); this .getRequest().setAttribute("city" , city); return "admin/editcity" ; } public CityService getCityService () { return cityService; } public void setCityService (CityService cityService) { this .cityService = cityService; } } package com.util;public class PageHelper { public static void getPage (List<?> list, String name, List<String> nameList, List<String> valueList, int pageSize, String number, HttpServletRequest request, String method) { StringBuffer buffer = new StringBuffer(); String name2 = name.substring(0 , 1 ).toUpperCase() + name.substring(1 ); String path = "" ; String action = "getAll" + name2 + ".action" ; if (method != null ) { action = "query" + name2 + "ByCond.action" ; } List<Object> objList = new ArrayList<Object>(); if (nameList != null && valueList != null ) { for (int i = 0 ; i < nameList.size(); i++) { path += "&" + nameList.get(i) + "=" + valueList.get(i); } } int pageNumber = list.size(); int maxPage = pageNumber; if (maxPage % 10 == 0 ) { maxPage = maxPage / 10 ; } else {
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 if ("peihuoname" .equals(cond)) { peihuo.setPeihuoname(name); } if ("cityid" .equals(cond)) { peihuo.setCityname(name); } if ("address" .equals(cond)) { peihuo.setAddress(name); } if ("contact" .equals(cond)) { peihuo.setContact(name); } if ("memo" .equals(cond)) { peihuo.setMemo(name); } } List<String> nameList = new ArrayList<String>(); List<String> valueList = new ArrayList<String>(); nameList.add(cond); valueList.add(name); PageHelper.getPage(this .peihuoService.getPeihuoByLike(peihuo), "peihuo" , nameList, valueList, 10 , number, this .getRequest(), "query" ); name = null ; cond = null ; return "admin/querypeihuo" ; } @RequestMapping("getPeihuoById.action") public String getPeihuoById (String id) { Peihuo peihuo = this .peihuoService.getPeihuoById(id); this .getRequest().setAttribute("peihuo" , peihuo); List<City> cityList = this .cityService.getAllCity(); this .getRequest().setAttribute("cityList" , cityList); return "admin/editpeihuo" ; } public PeihuoService getPeihuoService () { return peihuoService; } public void setPeihuoService (PeihuoService peihuoService) { this .peihuoService = peihuoService; } } package com.action;
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 @RequestMapping("deleteJiancai.action") public String deleteJiancai (String id) { this .jiancaiService.deleteJiancai(id); return "redirect:/jiancai/getAllJiancai.action" ; } @RequestMapping("deleteJiancaiByIds.action") public String deleteJiancaiByIds () { String[] ids = this .getRequest().getParameterValues("jiancaiid" ); for (String jiancaiid : ids) { this .jiancaiService.deleteJiancai(jiancaiid); } return "redirect:/jiancai/getAllJiancai.action" ; } @RequestMapping("updateJiancai.action") public String updateJiancai (Jiancai jiancai) { this .jiancaiService.updateJiancai(jiancai); return "redirect:/jiancai/getAllJiancai.action" ; } @RequestMapping("getAllJiancai.action") public String getAllJiancai (String number) { List<Jiancai> jiancaiList = this .jiancaiService.getAllJiancai(); PageHelper.getPage(jiancaiList, "jiancai" , null , null , 10 , number, this .getRequest(), null ); return "admin/listjiancai" ; } @RequestMapping("queryJiancaiByCond.action") public String queryJiancaiByCond (String cond, String name, String number) { Jiancai jiancai = new Jiancai(); if (cond != null ) { if ("jiancainame" .equals(cond)) { jiancai.setJiancainame(name); } if ("image" .equals(cond)) { jiancai.setImage(name);
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 List<Cate> cateList = this .cateService.getAllCate(); PageHelper.getPage(cateList, "cate" , null , null , 10 , number, this .getRequest(), null ); return "admin/listcate" ; } @RequestMapping("queryCateByCond.action") public String queryCateByCond (String cond, String name, String number) { Cate cate = new Cate(); if (cond != null ) { if ("catename" .equals(cond)) { cate.setCatename(name); } if ("memo" .equals(cond)) { cate.setMemo(name); } if ("addtime" .equals(cond)) { cate.setAddtime(name); } } List<String> nameList = new ArrayList<String>(); List<String> valueList = new ArrayList<String>(); nameList.add(cond); valueList.add(name); PageHelper.getPage(this .cateService.getCateByLike(cate), "cate" , nameList, valueList, 10 , number, this .getRequest(), "query" ); name = null ; cond = null ; return "admin/querycate" ; } @RequestMapping("getCateById.action") public String getCateById (String id) { Cate cate = this .cateService.getCateById(id); this .getRequest().setAttribute("cate" , cate); return "admin/editcate" ; } public CateService getCateService () { return cateService;
——————————PayStart——————————
项目链接: https://javayms.github.io?id=221122572008200tf https://javayms.pages.dev?id=221122572008200tf