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.format.annotation.DateTimeFormat;
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.JiudianguanliyuanEntity;
import com.entity.view.JiudianguanliyuanView;
import com.service.JiudianguanliyuanService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 酒店管理员
* 后端接口
* @author
* @email
* @date 2021-04-25 11:29:56
*/
@RestController
@RequestMapping("/jiudianguanliyuan")
public class JiudianguanliyuanController {
@Autowired
private JiudianguanliyuanService jiudianguanliyuanService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
JiudianguanliyuanEntity user = jiudianguanliyuanService.selectOne(new EntityWrapper<JiudianguanliyuanEntity>().eq("zhanghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(), username,"jiudianguanliyuan", "酒店管理员" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody JiudianguanliyuanEntity jiudianguanliyuan){
//ValidatorUtils.validateEntity(jiudianguanliyuan);
JiudianguanliyuanEntity user = jiudianguanliyuanService.selectOne(new EntityWrapper<JiudianguanliyuanEntity>().eq("zhanghao", jiudianguanliyuan.getZhanghao()));
if(user!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
jiudianguanliyuan.setId(uId);
jiudianguanliyuanService.insert(jiudianguanliyuan);
return R.ok();
}
/**
* 退出
*/
@RequestMapping("/logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Long id = (Long)request.getSession().getAttribute("userId");
JiudianguanliyuanEntity user = jiudianguanliyuanService.selectById(id);
return R.ok().put("data", user);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
JiudianguanliyuanEntity user = jiudianguanliyuanService.selectOne(new EntityWrapper<JiudianguanliyuanEntity>().eq("zhanghao", username));
if(user==null) {
return R.error("账号不存在");
}
user.setMima("123456");
jiudianguanliyuanService.updateById(user);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,JiudianguanliyuanEntity jiudianguanliyuan,
HttpServletRequest request){
EntityWrapper<JiudianguanliyuanEntity> ew = new EntityWrapper<JiudianguanliyuanEntity>();
PageUtils page = jiudianguanliyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiudianguanliyuan), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,JiudianguanliyuanEntity jiudianguanliyuan,
HttpServletRequest request){
EntityWrapper<JiudianguanliyuanEntity> ew = new EntityWrapper<JiudianguanliyuanEntity>();
PageUtils page = jiudianguanliyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiudianguanliyuan), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( JiudianguanliyuanEntity jiudianguanliyuan){
EntityWrapper<JiudianguanliyuanEntity> ew = new EntityWrapper<JiudianguanliyuanEntity>();
ew.allEq(MPUtil.allEQMapPre( jiudianguanliyuan, "jiudianguanliyuan"));
return R.ok().put("data", jiudianguanliyuanService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(JiudianguanliyuanEntity jiudianguanliyuan){
EntityWrapper< JiudianguanliyuanEntity> ew = new EntityWrapper< JiudianguanliyuanEntity>();
ew.allEq(MPUtil.allEQMapPre( jiudianguanliyuan, "jiudianguanliyuan"));
JiudianguanliyuanView jiudianguanliyuanView = jiudianguanliyuanService.selectView(ew);
return R.ok("查询酒店管理员成功").put("data", jiudianguanliyuanView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
JiudianguanliyuanEntity jiudianguanliyuan = jiudianguanliyuanService.selectById(id);
return R.ok().put("data", jiudianguanliyuan);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
JiudianguanliyuanEntity jiudianguanliyuan = jiudianguanliyuanService.selectById(id);
return R.ok().put("data", jiudianguanliyuan);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody JiudianguanliyuanEntity jiudianguanliyuan, HttpServletRequest request){
jiudianguanliyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(jiudianguanliyuan);
JiudianguanliyuanEntity user = jiudianguanliyuanService.selectOne(new EntityWrapper<JiudianguanliyuanEntity>().eq("zhanghao", jiudianguanliyuan.getZhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
jiudianguanliyuan.setId(new Date().getTime());
jiudianguanliyuanService.insert(jiudianguanliyuan);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody JiudianguanliyuanEntity jiudianguanliyuan, HttpServletRequest request){
jiudianguanliyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(jiudianguanliyuan);
JiudianguanliyuanEntity user = jiudianguanliyuanService.selectOne(new EntityWrapper<JiudianguanliyuanEntity>().eq("zhanghao", jiudianguanliyuan.getZhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
jiudianguanliyuan.setId(new Date().getTime());
jiudianguanliyuanService.insert(jiudianguanliyuan);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody JiudianguanliyuanEntity jiudianguanliyuan, HttpServletRequest request){
//ValidatorUtils.validateEntity(jiud
没有合适的资源?快使用搜索试试~ 我知道了~
【weixin6147】基于微信小程序的酒店管理系统-ssm-lw.zip
共2000个文件
png:385个
svg:324个
js:296个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 152 浏览量
2024-09-23
17:36:17
上传
评论
收藏 33.15MB ZIP 举报
温馨提示
技术选型 【后端】:Java 【框架】:springboot/ssm 【前端】:小程序 【JDK版本】:JDK1.8 【服务器】:tomcat7+ 【数据库】:mysql 5.7+ 包含:项目源码、数据库脚本、项目功能介绍文档等,该项目源码可作为毕设使用。 项目都经过严格调试,确保可以运行! 具体项目介绍可查看博主文章
资源推荐
资源详情
资源评论
收起资源包目录
【weixin6147】基于微信小程序的酒店管理系统-ssm-lw.zip (2000个子文件)
main.css.bak 63KB
main.css.bak 63KB
update-password.vue.bak 3KB
update-password.vue.bak 3KB
IndexAsideStatic.vue.bak 2KB
IndexAsideStatic.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
IndexHeader.vue.bak 2KB
IndexHeader.vue.bak 2KB
3-build.bat 15B
3-build.bat 15B
2-run.bat 14B
2-run.bat 14B
1-install.bat 12B
1-install.bat 12B
.classpath 1KB
.classpath 1KB
org.eclipse.wst.common.component 689B
org.eclipse.wst.common.component 689B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.jsdt.ui.superType.container 49B
app.df657d87.css 250KB
app.df657d87.css 250KB
bootstrap.css 143KB
bootstrap.css 143KB
bootstrap.min.css 118KB
bootstrap.min.css 118KB
index.2d26d90a.css 79KB
index.2d26d90a.css 79KB
icon.css 70KB
icon.css 70KB
main.css 64KB
main.css 64KB
chunk-vendors.1f0a25b2.css 37KB
chunk-vendors.1f0a25b2.css 37KB
global-restaurant.css 7KB
global-restaurant.css 7KB
mescroll-uni.css 4KB
mescroll-uni.css 4KB
animation.css 3KB
animation.css 3KB
论文.doc 1.76MB
论文.doc 1.76MB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.eot 20KB
.gitignore 10B
index.html 1KB
index.html 1KB
index.html 924B
index.html 924B
index.html 552B
index.html 552B
favicon.ico 4KB
favicon.ico 4KB
favicon.ico 4KB
favicon.ico 4KB
JiudianguanliyuanController.java 10KB
JiudianguanliyuanController.java 10KB
YonghuController.java 9KB
YonghuController.java 9KB
CommonController.java 8KB
CommonController.java 8KB
DingdanxinxiController.java 7KB
DingdanxinxiController.java 7KB
DiscussfangjianxinxiController.java 7KB
DiscussfangjianxinxiController.java 7KB
StoreupController.java 7KB
StoreupController.java 7KB
FangjianleixingController.java 7KB
FangjianleixingController.java 7KB
FangjianxinxiController.java 7KB
FangjianxinxiController.java 7KB
DingdanxinxiEntity.java 6KB
DingdanxinxiEntity.java 6KB
UserController.java 5KB
UserController.java 5KB
MPUtil.java 5KB
MPUtil.java 5KB
DingdanxinxiModel.java 5KB
DingdanxinxiModel.java 5KB
DingdanxinxiVO.java 5KB
DingdanxinxiVO.java 5KB
FangjianxinxiEntity.java 4KB
FangjianxinxiEntity.java 4KB
BaiduUtil.java 4KB
BaiduUtil.java 4KB
YonghuEntity.java 3KB
YonghuEntity.java 3KB
FangjianxinxiModel.java 3KB
FangjianxinxiModel.java 3KB
JiudianguanliyuanEntity.java 3KB
JiudianguanliyuanEntity.java 3KB
DiscussfangjianxinxiEntity.java 3KB
DiscussfangjianxinxiEntity.java 3KB
ConfigController.java 3KB
ConfigController.java 3KB
FangjianxinxiVO.java 3KB
FangjianxinxiVO.java 3KB
AuthorizationInterceptor.java 3KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Java码库
- 粉丝: 2215
- 资源: 6175
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 从 Java 到 Kotlin - 从 Java 到 Kotlin 的速查表.zip
- (源码)基于Spring Boot框架的项目管理系统.zip
- (源码)基于Java Servlet的在线购物系统.zip
- (源码)基于Java+Spring Boot的教务管理系统.zip
- 主要是Java技术栈的文章.zip
- (源码)基于Arduino平台的公共交通状态展示系统.zip
- (源码)基于Python和Raspberry Pi的PIC微控制器编程与数据记录系统.zip
- (源码)基于Linux系统的文件信息列表工具.zip
- (源码)基于Python和MXNet框架的ZJ League视频问题回答系统.zip
- (源码)基于C++的图书管理系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功