当前位置: 首页 > 编程日记 > 正文

Java项目:校园外卖点餐系统(java+SSM+JSP+maven+mysql)

源码获取:博客首页 "资源" 里下载!

一、项目简述

环境配置:

Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

JSP +Spring + SpringMVC + MyBatis + css + JavaScript + JQuery + Ajax + layui+ maven等等。


管理员controller控制层:

/*** 管理员controller*/
@Controller
@RequestMapping("/config")
public class UserController {@AutowiredUserRoleService userRoleService;@AutowiredUserService userService;@AutowiredRoleService roleService;@RequestMapping("/enableStatus")@ResponseBodypublic String enableStatus(@RequestParam(value = "name") String name){return userService.enableStatus(name);}@RequestMapping("/stopStatus")@ResponseBodypublic String stopStatus(@RequestParam(value = "name") String name){return userService.stopStatus(name);}@RequestMapping("/adminAdd")public String adminadd(Model model){List<Role> list = roleService.list();model.addAttribute("rolelist",list);return "syspage/admin-add";}@RequestMapping("/listUser")public String list(Model model, Page page){PageHelper.offsetPage(page.getStart(),page.getCount());//分页查询List<User> us= userService.list();int total = (int) new PageInfo<>(us).getTotal();//总条数page.setTotal(total);model.addAttribute("us", us);//所有用户model.addAttribute("total",total);Map<User,List<Role>> user_roles = new HashMap<>();//每个用户对应的权限for (User user : us) {List<Role> roles=roleService.listRoles(user);user_roles.put(user, roles);}model.addAttribute("user_roles", user_roles);return "syspage/admin-list";}/*** 修改管理员角色* @param model* @param id* @return*/@RequestMapping("/editUser")public String edit(Model model,Long id){List<Role> rs = roleService.list();model.addAttribute("rs", rs);      User user =userService.get(id);model.addAttribute("user", user);//当前拥有的角色List<Role> roles =roleService.listRoles(user);model.addAttribute("currentRoles", roles);return "syspage/admin-edit";}@RequestMapping("deleteUser")public String delete(Model model,long id){userService.delete(id);return "redirect:listUser";}@RequestMapping("updateUser")public String update(User user, long[] roleIds){userRoleService.setRoles(user,roleIds);String password=user.getPassword();//如果在修改的时候没有设置密码,就表示不改动密码if(user.getPassword().length()!=0) {String salt = new SecureRandomNumberGenerator().nextBytes().toString();int times = 2;String algorithmName = "md5";String encodedPassword = new SimpleHash(algorithmName,password,salt,times).toString();user.setSalt(salt);user.setPassword(encodedPassword);}elseuser.setPassword(null);userService.update(user);return "redirect:listUser";}@RequestMapping("addUser")public String add(User user,long[] roleIds){String salt = new SecureRandomNumberGenerator().nextBytes().toString();//生成随机数int times = 2;String algorithmName = "md5";String encodedPassword = new SimpleHash(algorithmName,user.getPassword(),salt,times).toString();User u = new User();u.setName(user.getName());u.setPassword(encodedPassword);u.setSalt(salt);u.setStatus(1);u.setAddress(user.getAddress());u.setPhone(user.getPhone());userService.add(u);userRoleService.setRoles(u,roleIds);return "redirect:listUser";}}

管理员角色controler控制层:

/*** 管理员角色controler*/
@Controller
@RequestMapping("/config")
public class RoleController {@AutowiredRoleService roleService;@AutowiredRolePermissionService rolePermissionService;@AutowiredPermissionService permissionService;@RequestMapping("/addRoleUI")public String addRole(){return "syspage/admin-role-add";}@RequestMapping("/listRole")public String list(Model model, Page page){PageHelper.offsetPage(page.getStart(),page.getCount());//分页查询List<Role> rs= roleService.list();int total = (int) new PageInfo<>(rs).getTotal();//总条数page.setTotal(total);model.addAttribute("rs", rs);model.addAttribute("roleSize",total);Map<Role,List<Permission>> role_permissions = new HashMap<>();for (Role role : rs) {List<Permission> ps = permissionService.list(role);role_permissions.put(role, ps);}model.addAttribute("role_permissions", role_permissions);return "syspage/admin-role";}@RequestMapping("/editRole")public String list(Model model,long id){Role role =roleService.get(id);model.addAttribute("role", role);//所有权限List<Permission> ps = permissionService.list();model.addAttribute("ps", ps);//当前管理员拥有的权限List<Permission> currentPermissions = permissionService.list(role);model.addAttribute("currentPermissions", currentPermissions);return "syspage/admin-role-edit";}@RequestMapping("/updateRole")public String update(Role role,long[] permissionIds){rolePermissionService.setPermissions(role, permissionIds);roleService.update(role);return "redirect:listRole";}@RequestMapping("/addRole")public String list(Model model,Role role){roleService.add(role);return "redirect:listRole";}@RequestMapping("/deleteRole")public String delete(Model model,long id){roleService.delete(id);return "redirect:listRole";}   }

后台登录控制层:

/*** 后台登陆*/
@Controller
@RequestMapping("")
public class LoginController {@AutowiredUserService userService;@RequestMapping(value="/login",method=RequestMethod.POST)public String login(Model model, String name, String password){//throws ParseExceptionSubject subject = SecurityUtils.getSubject();UsernamePasswordToken token = new UsernamePasswordToken(name,password);try {subject.login(token);User us = userService.getByName(name);String lastLoginTime = "";if(us!=null){SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//上次时间Date time = us.getLasttime();lastLoginTime = sdf.format(time);//新时间String format = sdf.format(new Date());//string转date  不处理时间格式会不理想ParsePosition pos = new ParsePosition(0);Date strtodate = sdf.parse(format, pos);us.setLasttime(strtodate);userService.update(us);}if (us.getStatus()==1){Session session=subject.getSession();session.setAttribute("subject", subject);session.setAttribute("lastLoginTime",lastLoginTime);return "redirect:index";}else {model.addAttribute("error", "账号已被停用!");return "/login";}} catch (AuthenticationException e) {model.addAttribute("error", "验证失败!");return "/login";}}}

订单模块controller控制层:

/*** 订单模块controller*/
@Controller
@RequestMapping("/order")
public class OrderController {@AutowiredOrderService orderService;@AutowiredOrderItemService orderItemService;/*** 所有订单* @param model* @param page* @return*/@RequestMapping("/list")public String list(Model model, Page page){PageHelper.offsetPage(page.getStart(),page.getCount());List<Order> os= orderService.list();int total = (int) new PageInfo<>(os).getTotal();page.setTotal(total);//为订单添加订单项数据orderItemService.fill(os);model.addAttribute("os", os);model.addAttribute("page", page);model.addAttribute("totals", total);return "ordermodule/order-list";}/*** 订单发货* @param o* @return*/@RequestMapping("/orderDelivery")public String delivery(Order o){o.setStatus(2);orderService.update(o);return "redirect:list";}/*** 查看当前订单的订单项* @param oid* @param model* @return*/@RequestMapping("/seeOrderItem")public String seeOrderItem(int oid,Model model){Order o = orderService.get(oid);orderItemService.fill(o);model.addAttribute("orderItems",o.getOrderItems());model.addAttribute("total",o.getOrderItems().size());model.addAttribute("totalPrice",o.getTotal());return "ordermodule/orderItem-list";}}

源码获取:博客首页 "资源" 里下载!

相关文章:

基于css3 transform实现散乱的照片排列

分享一款基于css3 transform实现散乱的照片排列。这是一款简单零散的css3相册排列特效下载。效果图如下&#xff1a; 在线预览 源码下载 实现的代码。 html代码&#xff1a; <div class"main"><div class"pic pic1"><img src"1.jpg…

C++利用二级指针做函数形参来进行修改实参的实例分析

在学C/C的时候&#xff0c;我们都会了解到一级指针&#xff0c;int* i NULL; 和二级指针int ** pp NULL; 但是具体的一些应用我们可能很难理解&#xff0c;如果我们要取int*的地址&#xff0c;我们就需要int**&#xff0c;这是因为指针传递本质上还是值传递,本质很难理解&a…

SpringBoot 优雅实现超大文件上传,通用方案

通俗的说,你把要上传的东西上传,服务器会先做MD5校验,如果服务器上有一样的东西,它就直接给你个新地址,其实你下载的都是服务器上的同一个文件,想要不秒传,其实只要让MD5改变,就是对文件本身做一下修改(改名字不行),例如一个文本文件,你多加几个字,MD5就变了,就不会秒传了。分片上传,就是将所要上传的文件,按照一定的大小,将整个文件分隔成多个数据块(我们称之为Part)来进行分别上传,上传完之后再由服务端对所有上传的文件进行汇总整合成原始的文件。

robotframework - 运行报错提示 No keyword with name 'Open Browser' found.

用下面的例子为例&#xff1a; 1、输入以上robot脚本提示&#xff1a; 2、经查阅资料&#xff0c;大部分都使用的是selenium2 版本&#xff0c;无法解该的问题&#xff0c;目前小编使用的是selenium3&#xff0c;不知道selenium是哪个版本的话&#xff0c;用pip show selenium…

Linux从程序到进程

作者&#xff1a;Vamei 出处&#xff1a;http://www.cnblogs.com/vamei 欢迎转载&#xff0c;也请保留这段声明。谢谢&#xff01; 计算机如何执行进程呢&#xff1f;这可以说是计算机运行的核心问题。即使我们已经编写好程序&#xff0c;但程序是死的文本&#xff0c;只有成为…

struct stat结构体的详解和用法

[cpp] view plaincopy//! 需要包含de头文件 #include <sys/types.h> #include <sys/stat.h> S_ISLNK(st_mode)&#xff1a;是否是一个连接.S_ISREG(st_mode)&#xff1a;是否是一个常规文件.S_ISDIR(st_mode)&#xff1a;是否是一个目录S_ISCHR(st_mode)&a…

反射setaccessible_反射技术

反射机制作用动态的加载类、动态的获取类的信息(属性&#xff0c;方法&#xff0c;构造器)动态构造对象动态调用类和对象的任意方法、构造器动态调用和处理属性获取泛型信息处理注解获取Class对象的方式有哪些&#xff1f;1. Class clazz Class.forName(全限定类名);2. 类名.c…

pthread_cond_wait()函数的详解

http://hi.baidu.com/tjuer/item/253cc6d66b921317d90e4483 了解 pthread_cond_wait() 的作用非常重要 -- 它是 POSIX 线程信号发送系统的核心&#xff0c;也是最难以理解的部分。 首先&#xff0c;让我们考虑以下情况&#xff1a;线程为查看已链接列表而锁定了互斥对象&#x…

CentOS7下python虚拟环境

搭建python虚拟环境 1.我们先创建一个隐藏目录 .virtualenvs&#xff0c;所有的虚拟环境都放在此目录下 &#xff1a;mkdir /root/.virtualenvs 2.安装虚拟环境 确认pip&#xff1a;whereis pip3 pip3 install virtualenv 安装virtualenvwrapper&#xff0c;为避免超时错误&…

WCDMA中的URA和LA/RA

1、关于URA的概念&#xff1a;URA&#xff08;UTRAN Registration Area&#xff09;是UTRAN内部区域的划分适用于UE处于RRC连接状态的情形&#xff0c;而且只能在UTRAN端使用&#xff08;比如由UTRAN发起的寻呼&#xff09;。一 个URA包含了一个或多个Cell&#xff0c;具体由决…

背景音乐的实现

通过利用Service来实现该功能将要播放的歌曲放入raw文件夹中[html] view plaincopy <strong>新建一个AudioService 类&#xff0c;<span style"font-family: Arial, Helvetica, sans-serif;">AudioService 类</span><span style"font-fami…

打牌软件可以控制吗_使用crm软件真的可以帮助企业省钱吗

使用crm软件真的可以帮助企业省钱吗大多数企业管理者认为&#xff1a;“客户关系系统有什么用?真的可以帮助企业发展吗?自己做一套excel版本不就行了”其实&#xff0c;不以为然&#xff0c;当我们去寻找用户时或者管理用户需要工作人员做一些繁琐的事情会极大的降低员工的工…

MS_SQL_获取字符串最后出现的字符串及位置

一&#xff0e;如&#xff1a;6.7.8.2.3.4.x得到最后一个.后面的字符串&#xff1a; declare str1 varchar(50) set str16.7.8.2.3.4.x select REVERSE(SUBSTRING(REVERSE(str1),1,CHARINDEX(.,REVERSE(str1))-1)) -------- string:x-- --------------------------------------…

redis(3)-redis基本类型

在redis安装目录下存在redis自带的客户端&#xff0c;启动即可使用。如果设置了密码&#xff0c;需要输入auth 123456进行验证。123456为密码。 redis的基本数据类型&#xff1a; 1.字符串类型(String)    redis 127.0.0.1:6379> SET mykey "redis" OK redis 1…

虚函数与虚继承寻踪

封装、继承、多态是面向对象语言的三大特性&#xff0c;熟悉C的人对此应该不会有太多异议。C语言提供的struct&#xff0c;顶多算得上对数据的简单封装&#xff0c;而C的引入把struct“升级”为class&#xff0c;使得面向对象的概念更加强大。继承机制解决了对象复用的问题&…

信息记录拉取失败_天猫入驻为什么失败?猫店侠做详细解读

天猫入驻为什么失败&#xff1f;这是很多商家都想要知道的一件事情&#xff0c;猫店侠想说其实这也很正常&#xff0c;只要不是一味盲目的入驻&#xff0c;就还有机会。首先失败商家要看看失败的反馈内容&#xff0c;看看是哪方面不达标&#xff0c;再着重进行补充&#xff0c;…

Linux查看目录挂载点

用命令 df 即可 # df /var/lib/ Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 135979984 66905292 62055896 52% /加上-kh更容易看些&#xff1a; # df /var/lib/ -kh Filesystem Size Used Avail Use% Mounted o…

Android:你好,androidX!再见,android.support

190325 补充&#xff1a;莫名问题的解决 181106 补充&#xff1a;修改未迁移成功的三方库 1、AndroidX简介 点击查看Android文档中对androidx的简介 按照官方文档说明 androidx 是对 android.support.xxx 包的整理后产物。由于之前的support包过于混乱&#xff0c;所以&#xf…

设计模式:简单工厂、工厂方法、抽象工厂之小结与区别

简单工厂&#xff0c;工厂方法&#xff0c;抽象工厂都属于设计模式中的创建型模式。其主要功能都是帮助我们把对象的实例化部分抽取了出来&#xff0c;优化了系统的架构&#xff0c;并且增强了系统的扩展性。 本文是本人对这三种模式学习后的一个小结以及对他们之间的区别的理解…

云计算和大数据时代网络技术揭秘(八)数据中心存储FCoE

数据中心存储演化——FCoE数据中心三大基础&#xff1a;主机 网络 存储在云计算推动下&#xff0c;存储基础架构在发生演变传统存储结构DAS、SAN在发展中遇到了布线复杂、能耗增多的缺点&#xff08;原生性&#xff09;&#xff0c;需要对架构做根本的改变。FCoE是业界无可争议…

在plsql里面怎么去掉空行_盐渍樱花怎么做?详细做法告诉您,一年都不会坏,学会再也不用买...

盐渍樱花怎么做&#xff1f;详细做法告诉您&#xff0c;一年都不会坏&#xff0c;赶紧收藏学会它&#xff01;樱花季说的就是现在&#xff0c;虽然到了飘落的季节&#xff0c;但是还是到处可见的樱花朵朵。俗话说&#xff1a;花无百日红。真的是啊&#xff0c;每年的三四月是最…

Linux基础知识——常用shell命令介绍(三)

一、改变文件权限 chmod:change mode 语法&#xff1a;# chmod [选项-option] 权限 FILE 选项&#xff1a;-R 递归修改权限 --reference 参照文件或目录给予权限 权限定义方式&#xff1a; 1.同时修改三类用户的权限: 8进制数字方式 # chmod 666 /abc /*将/abc的权限改为…

免费版CloudFlare CDN基本设置参考

CDN有很多&#xff0c;网上都有介绍&#xff0c;用户比较多的CloudFlare CDN大家都知道&#xff0c;配置起来也比较简单&#xff0c;合理的配置&#xff0c;才能提升网站的速度和网站安全。不同的网站需求配置不一样&#xff0c;以下是我的配置情况&#xff0c;仅供参考。 我网…

从Java类库看设计模式

//From http://www.uml.org.cn/j2ee/201010214.asp 很多时候&#xff0c;对于一个设计来说(软件上的&#xff0c;建筑上的&#xff0c;或者它他工业上的)&#xff0c;经验是至关重要的。好的经验给我们以指导&#xff0c;并节约我们的时间;坏的经验则给我们以借鉴&#xff0c;可…

method=post 怎么让查看源代码看不到_网站文档不能复制怎么办?教你3个小妙招,1分钟轻松化解...

不知道大家平常在查找资料时&#xff0c;碰到网页资料不能下载时&#xff0c;是怎么样进行处理的。那么笔者今天就来分享我查找不能复制文档时&#xff0c;所用的3个小妙招&#xff0c;帮助轻松化解&#xff0c;一起来看看吧。1、保存网页当我们遇到一个不能直接复制的文档&…

Missing number

题目链接&#xff1a;http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id114468 题目大意&#xff1a; 多组案例T&#xff0c;每个案例含n2个数据&#xff0c;这n2个数据构成一组有序列&#xff0c;现在已知这组数据中的n个&#xff0c;请找出缺失的两个数据。 …

[leetcode]Surrounded Regions @ Python

原题地址&#xff1a;https://oj.leetcode.com/problems/surrounded-regions/ 题意&#xff1a; Given a 2D board containing X and O, capture all regions surrounded by X. A region is captured by flipping all Os into Xs in that surrounded region. For example, X X …

Android Drawable 详解(教你画画!)

参考 1、Android中的Drawable基础与自定义Drawable2、android中的drawable资源3、Android开发之Shape详细解读 Drawable分类 Noxml标签Class类含义1shapeShapeDrawable特定形状&#xff0c;模型的图样2selectorStateListDrawable不同状态选择不同的图样3layer-listLayerDrawabl…

Carrier frequency 和 EARFCN的关系

Carrier frequency 和 EARFCN的关系 我们处理UE log时&#xff0c;看到LTE cell 都是用EARFCN/PCI来标示的&#xff0c;那么EARFCN和frequency 之间是什么关系呢&#xff1f; 1. EARFCN: 缩写: E-UTRA Absolute Radio Frequency Channel Number, 取值范围: 0…

十五天精通WCF——第六天 你必须要了解的3种通信模式

十五天精通WCF——第六天 你必须要了解的3种通信模式 原文:十五天精通WCF——第六天 你必须要了解的3种通信模式wcf已经说到第六天了&#xff0c;居然还没有说到这玩意有几种通信模式&#xff0c;惭愧惭愧&#xff0c;不过很简单啦&#xff0c;单向&#xff0c;请求-响应&#…