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.YonghuEntity;
import com.entity.view.YonghuView;
import com.service.YonghuService;
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-12 10:10:08
*/
@RestController
@RequestMapping("/yonghu")
public class YonghuController {
@Autowired
private YonghuService yonghuService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(), username,"yonghu", "用户" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody YonghuEntity yonghu){
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(user!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
yonghu.setId(uId);
yonghuService.insert(yonghu);
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");
YonghuEntity user = yonghuService.selectById(id);
return R.ok().put("data", user);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
if(user==null) {
return R.error("账号不存在");
}
user.setMima("123456");
yonghuService.updateById(user);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,YonghuEntity yonghu,
HttpServletRequest request){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,YonghuEntity yonghu, HttpServletRequest request){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( YonghuEntity yonghu){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
return R.ok().put("data", yonghuService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(YonghuEntity yonghu){
EntityWrapper< YonghuEntity> ew = new EntityWrapper< YonghuEntity>();
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
YonghuView yonghuView = yonghuService.selectView(ew);
return R.ok("查询用户成功").put("data", yonghuView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
YonghuEntity yonghu = yonghuService.selectById(id);
return R.ok().put("data", yonghu);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
YonghuEntity yonghu = yonghuService.selectById(id);
return R.ok().put("data", yonghu);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
yonghu.setId(new Date().getTime());
yonghuService.insert(yonghu);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
yonghu.setId(new Date().getTime());
yonghuService.insert(yonghu);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
//ValidatorUtils.validateEntity(yonghu);
yonghuService.updateById(yonghu);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
yonghuService.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(Cal
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
sql毕业设计基于ssm框架+微信小程序的体育资讯平台项目源码.zip 个人经导师指导并认可通过的高分设计项目,评审分98分。主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的学习者,也可作为课程设计、期末大作业。 项目介绍: 体育资讯平台项目, 前端为微信小程序,后端接口为ssm框架实现,项目包含源码、数据库 毕业设计基于ssm框架+微信小程序的体育资讯平台项目源码.zip 个人经导师指导并认可通过的高分设计项目,评审分98分。主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的学习者,也可作为课程设计、期末大作业。 项目主要功能: 这是一个基于SSM框架和微信小程序的体育资讯平台项目。它为管理员和用户提供服务。管理员可以管理个人中心、球员、用户、教练、赛事、赛事类型、积分榜、足球周边、商品类型、系统及订单。普通用户则能浏览资讯,查看赛事日程,购买足球周边,并在个人中心管理自己的订单。项目采用JAVA技术和MYSQL数据库开发,利用微信平台,提供无需下载安装、快速访问的体验。系统设计简洁,便于使用,节省用户时间和资源。论文包含了开发背景、相关技术介绍、需求分析
资源推荐
资源详情
资源评论
收起资源包目录
基于ssm框架+微信小程序的体育资讯平台项目源码 (1202个子文件)
main.css.bak 63KB
update-password.vue.bak 3KB
IndexAsideStatic.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
IndexHeader.vue.bak 2KB
3-build.bat 15B
2-run.bat 14B
1-install.bat 12B
.classpath 1KB
org.eclipse.wst.common.component 689B
org.eclipse.wst.jsdt.ui.superType.container 49B
bootstrap.css 143KB
bootstrap.min.css 118KB
index.2d26d90a.css 79KB
icon.css 70KB
main.css 64KB
global-restaurant.css 7KB
mescroll-uni.css 4KB
animation.css 3KB
glyphicons-halflings-regular.eot 20KB
.gitignore 10B
index.html 1KB
index.html 552B
favicon.ico 4KB
YonghuController.java 9KB
CommonController.java 8KB
CartController.java 6KB
NewsController.java 6KB
OrdersEntity.java 6KB
UserController.java 5KB
MPUtil.java 5KB
OrdersModel.java 5KB
OrdersVO.java 5KB
SaishirichengEntity.java 5KB
LiansaijifenbangEntity.java 5KB
BeisaijifenbangEntity.java 5KB
QiuyuanEntity.java 4KB
ZuqiuzhoubianEntity.java 4KB
YonghuEntity.java 4KB
CartEntity.java 4KB
BaiduUtil.java 4KB
JiaolianEntity.java 4KB
SaishirichengModel.java 3KB
SaishirichengVO.java 3KB
LiansaijifenbangModel.java 3KB
BeisaijifenbangModel.java 3KB
QiuyuanModel.java 3KB
LiansaijifenbangVO.java 3KB
BeisaijifenbangVO.java 3KB
QiuyuanVO.java 3KB
ZuqiuzhoubianModel.java 3KB
ConfigController.java 3KB
AddressEntity.java 3KB
ZuqiuzhoubianVO.java 3KB
AuthorizationInterceptor.java 3KB
YonghuModel.java 3KB
NewsEntity.java 3KB
YonghuVO.java 3KB
Query.java 3KB
CartModel.java 3KB
CartVO.java 2KB
TokenServiceImpl.java 2KB
JiaolianModel.java 2KB
JiaolianVO.java 2KB
TokenEntity.java 2KB
LiansaijifenbangServiceImpl.java 2KB
ShangpinleixingServiceImpl.java 2KB
BeisaijifenbangServiceImpl.java 2KB
ShangpinleixingEntity.java 2KB
SaishileixingEntity.java 2KB
SaishirichengServiceImpl.java 2KB
ZuqiuzhoubianServiceImpl.java 2KB
SaishileixingServiceImpl.java 2KB
PageUtils.java 2KB
JiaolianServiceImpl.java 2KB
QiuyuanServiceImpl.java 2KB
AddressServiceImpl.java 2KB
YonghuServiceImpl.java 2KB
OrdersServiceImpl.java 2KB
NewsServiceImpl.java 2KB
CartServiceImpl.java 2KB
AddressModel.java 2KB
AddressVO.java 2KB
NewsModel.java 1KB
NewsVO.java 1KB
UserServiceImpl.java 1KB
CommonServiceImpl.java 1KB
UserEntity.java 1KB
SpringContextUtils.java 1KB
ValidatorUtils.java 1KB
LiansaijifenbangService.java 1KB
BeisaijifenbangService.java 1KB
ShangpinleixingService.java 1KB
LiansaijifenbangDao.java 1KB
SQLFilter.java 1KB
ZuqiuzhoubianService.java 1KB
SaishirichengService.java 1KB
SaishileixingService.java 1KB
BeisaijifenbangDao.java 1KB
ShangpinleixingDao.java 1KB
共 1202 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
资源评论
xziyuan
- 粉丝: 879
- 资源: 129
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功