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.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.MPUtil;
import com.utils.CommonUtil;
/**
* 用户
* 后端接口
* @author
* @email
* @date 2020-11-13 14:48:16
*/
@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("yonghuming", 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("yonghuming", yonghu.getYonghuming()));
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("yonghuming", 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") String id){
YonghuEntity yonghu = yonghuService.selectById(id);
return R.ok().put("data", yonghu);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") String 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("yonghuming", yonghu.getYonghuming()));
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("yonghuming", yonghu.getYonghuming()));
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(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
没有合适的资源?快使用搜索试试~ 我知道了~
SSM运动品交易商城及源码数据库和论文
共1177个文件
java:185个
class:185个
svg:164个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 64 浏览量
2024-09-14
09:17:24
上传
评论
收藏 38.06MB ZIP 举报
温馨提示
本系统主要针对计算机相关专业的正在做毕业设计的学生和需要项目实战练习的学习者,可作为毕业设计、课程设计、期末大作业。
资源推荐
资源详情
资源评论
收起资源包目录
SSM运动品交易商城及源码数据库和论文 (1177个子文件)
IndexAsideStatic.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
IndexHeader.vue.bak 2KB
2-run.bat 14B
1-install.bat 12B
YonghuController.class 10KB
CommonController.class 10KB
ForumController.class 9KB
AddressController.class 9KB
ChatController.class 8KB
StoreupController.class 8KB
MessagesController.class 8KB
DiscussmingxingtongkuanController.class 8KB
OrdersController.class 8KB
DiscussshangpinxinxiController.class 8KB
CartController.class 8KB
MingxingtongkuanController.class 8KB
ShangpinxinxiController.class 8KB
ShangpinleibieController.class 8KB
PeisongxinxiController.class 8KB
ChukuxinxiController.class 7KB
RizhixinxiController.class 7KB
RukuxinxiController.class 7KB
NewsController.class 7KB
MPUtil.class 7KB
UserController.class 6KB
OrdersEntity.class 5KB
TokenServiceImpl.class 4KB
FileController.class 4KB
MingxingtongkuanEntity.class 4KB
BaiduUtil.class 4KB
DiscussmingxingtongkuanServiceImpl.class 4KB
CartEntity.class 4KB
DiscussshangpinxinxiServiceImpl.class 4KB
ForumEntity.class 4KB
ShangpinxinxiEntity.class 4KB
MingxingtongkuanServiceImpl.class 4KB
ShangpinleibieServiceImpl.class 4KB
ShangpinxinxiServiceImpl.class 4KB
PeisongxinxiServiceImpl.class 4KB
RizhixinxiServiceImpl.class 4KB
ChukuxinxiServiceImpl.class 4KB
RukuxinxiServiceImpl.class 4KB
MessagesServiceImpl.class 4KB
AddressServiceImpl.class 4KB
StoreupServiceImpl.class 4KB
YonghuServiceImpl.class 4KB
OrdersServiceImpl.class 4KB
ForumServiceImpl.class 4KB
ConfigController.class 4KB
ChatServiceImpl.class 4KB
NewsServiceImpl.class 4KB
CartServiceImpl.class 4KB
YonghuEntity.class 4KB
AuthorizationInterceptor.class 3KB
ChukuxinxiEntity.class 3KB
RukuxinxiEntity.class 3KB
PeisongxinxiEntity.class 3KB
ChatEntity.class 3KB
StoreupEntity.class 3KB
AddressEntity.class 3KB
OrdersModel.class 3KB
OrdersVO.class 3KB
MessagesEntity.class 3KB
Query.class 3KB
RizhixinxiEntity.class 3KB
DiscussmingxingtongkuanEntity.class 3KB
DiscussshangpinxinxiEntity.class 3KB
NewsEntity.class 3KB
UserServiceImpl.class 3KB
PageUtils.class 3KB
TokenEntity.class 3KB
MingxingtongkuanModel.class 2KB
MingxingtongkuanVO.class 2KB
ShangpinleibieEntity.class 2KB
CommonServiceImpl.class 2KB
CartModel.class 2KB
CartVO.class 2KB
ShangpinxinxiModel.class 2KB
R.class 2KB
DiscussmingxingtongkuanService.class 2KB
ShangpinxinxiVO.class 2KB
DiscussmingxingtongkuanDao.class 2KB
DiscussshangpinxinxiService.class 2KB
UserEntity.class 2KB
DiscussshangpinxinxiDao.class 2KB
ValidatorUtils.class 2KB
SpringContextUtils.class 2KB
MingxingtongkuanService.class 2KB
MingxingtongkuanDao.class 2KB
ShangpinleibieService.class 2KB
ShangpinxinxiService.class 2KB
PeisongxinxiService.class 2KB
ShangpinleibieDao.class 2KB
ChukuxinxiModel.class 2KB
RukuxinxiModel.class 2KB
ShangpinxinxiDao.class 2KB
ChukuxinxiVO.class 2KB
RukuxinxiVO.class 2KB
RizhixinxiService.class 2KB
共 1177 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
资源评论
Java旅途
- 粉丝: 1w+
- 资源: 3049
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MATLAB界面版本-数字信号处理GUI界面.zip
- MATLAB界面版本-水果分级系统.zip
- MATLAB界面版本-水果成熟度分析.zip
- MATLAB界面版本-水果识别.zip
- MATLAB界面版本-图像去雾设计.zip
- MATLAB界面版本-图像去雾系统.zip
- MATLAB界面版本-图像去雾.zip
- MATLAB界面版本-雾霾车牌识别GUI设计.zip
- MATLAB界面版本-五官检测系统.zip
- MATLAB界面版本-危险区域预警系统.zip
- MATLAB界面版本-香烟汉字识别.zip
- MATLAB界面版本-芯片字符识别.zip
- 二维傅里叶变,2D傅里叶变,图像傅里叶变 matlab2018a及以上运行 对图像进行灰度处理后进行做傅里叶变 图中分别是原始图像,灰度处理后的图像, 快速傅里叶变后的图像及移动零频的图像 彩色图为使
- MATLAB界面版本-信号与系统数字信号设计.zip
- MATLAB界面版本-印刷品缺陷检测.zip
- STM32内部12位ADC智能路灯项目,包括程序源码和protues仿真,通过内部ADC采集光敏电阻电压,判断电压值,电压低于设定值,表示光线太弱,开路灯 光线合适,灯不亮, 程序源码注释详细,非常
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功