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.HuiyuanEntity;
import com.entity.view.HuiyuanView;
import com.service.HuiyuanService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 会员
* 后端接口
* @author
* @email
* @date 2020-10-24 18:10:15
*/
@RestController
@RequestMapping("/huiyuan")
public class HuiyuanController {
@Autowired
private HuiyuanService huiyuanService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
HuiyuanEntity user = huiyuanService.selectOne(new EntityWrapper<HuiyuanEntity>().eq("zhanghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(), username,"huiyuan", "会员" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody HuiyuanEntity huiyuan){
//ValidatorUtils.validateEntity(huiyuan);
HuiyuanEntity user = huiyuanService.selectOne(new EntityWrapper<HuiyuanEntity>().eq("zhanghao", huiyuan.getZhanghao()));
if(user!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
huiyuan.setId(uId);
huiyuanService.insert(huiyuan);
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");
HuiyuanEntity user = huiyuanService.selectById(id);
return R.ok().put("data", user);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
HuiyuanEntity user = huiyuanService.selectOne(new EntityWrapper<HuiyuanEntity>().eq("zhanghao", username));
if(user==null) {
return R.error("账号不存在");
}
user.setMima("123456");
huiyuanService.updateById(user);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,HuiyuanEntity huiyuan, HttpServletRequest request){
EntityWrapper<HuiyuanEntity> ew = new EntityWrapper<HuiyuanEntity>();
PageUtils page = huiyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, huiyuan), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,HuiyuanEntity huiyuan, HttpServletRequest request){
EntityWrapper<HuiyuanEntity> ew = new EntityWrapper<HuiyuanEntity>();
PageUtils page = huiyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, huiyuan), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( HuiyuanEntity huiyuan){
EntityWrapper<HuiyuanEntity> ew = new EntityWrapper<HuiyuanEntity>();
ew.allEq(MPUtil.allEQMapPre( huiyuan, "huiyuan"));
return R.ok().put("data", huiyuanService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(HuiyuanEntity huiyuan){
EntityWrapper< HuiyuanEntity> ew = new EntityWrapper< HuiyuanEntity>();
ew.allEq(MPUtil.allEQMapPre( huiyuan, "huiyuan"));
HuiyuanView huiyuanView = huiyuanService.selectView(ew);
return R.ok("查询会员成功").put("data", huiyuanView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id){
HuiyuanEntity huiyuan = huiyuanService.selectById(id);
return R.ok().put("data", huiyuan);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") String id){
HuiyuanEntity huiyuan = huiyuanService.selectById(id);
return R.ok().put("data", huiyuan);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody HuiyuanEntity huiyuan, HttpServletRequest request){
huiyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(huiyuan);
HuiyuanEntity user = huiyuanService.selectOne(new EntityWrapper<HuiyuanEntity>().eq("zhanghao", huiyuan.getZhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
huiyuan.setId(new Date().getTime());
huiyuanService.insert(huiyuan);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody HuiyuanEntity huiyuan, HttpServletRequest request){
huiyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(huiyuan);
HuiyuanEntity user = huiyuanService.selectOne(new EntityWrapper<HuiyuanEntity>().eq("zhanghao", huiyuan.getZhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
huiyuan.setId(new Date().getTime());
huiyuanService.insert(huiyuan);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody HuiyuanEntity huiyuan, HttpServletRequest request){
//ValidatorUtils.validateEntity(huiyuan);
huiyuanService.updateById(huiyuan);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
huiyuanService.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 && !map.get("remindstart").toString().equals("")) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toSt
没有合适的资源?快使用搜索试试~ 我知道了~
ssm农业商品信息管理权限后台子系统.zip
共800个文件
java:150个
html:92个
jpg:89个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 180 浏览量
2024-11-26
08:28:48
上传
评论
收藏 57.33MB ZIP 举报
温馨提示
重点:所有项目都有sql文件,比其他博主项目要严谨一万倍所有项目本人亲自测试可运行使用!!有任何问题私我解决! 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 求注关 所有9.9的项目,企业项目都有SQL文件,购买后运行部署可联系包你满意。不容易啊,谢谢大家支持!!
资源推荐
资源详情
资源评论
收起资源包目录
ssm农业商品信息管理权限后台子系统.zip (800个子文件)
2-run.bat 14B
1-install.bat 12B
ssm-schema\target\classes\com\controller\UserController.class 5KB
ssm-schema\target\classes\com\controller\CommonController.class 3KB
ssm-schema\target\classes\com\utils\MPUtil.class 3KB
ssm-schema\target\classes\com\controller\FileController.class 3KB
ssm-schema\target\classes\com\service\impl\UserServiceImpl.class 3KB
ssm-schema\target\classes\com\utils\SpringContextUtils.class 2KB
ssm-schema\target\classes\com\utils\PageUtils.class 2KB
ssm-schema\target\classes\com\utils\Query.class 2KB
ssm-schema\target\classes\com\interceptor\AuthorizationInterceptor.class 2KB
ssm-schema\target\classes\com\utils\R.class 2KB
ssm-schema\target\classes\com\service\impl\CommonServiceImpl.class 2KB
ssm-schema\target\classes\com\entity\UserEntity.class 1KB
ssm-schema\target\classes\com\utils\ValidatorUtils.class 1KB
ssm-schema\target\classes\com\utils\JQPageInfo.class 1KB
ssm-schema\target\classes\com\entity\EIException.class 1KB
ssm-schema\target\classes\com\config\MyMetaObjectHandler.class 1KB
ssm-schema\target\classes\com\model\enums\TypeEnum.class 1KB
ssm-schema\target\classes\com\dao\UserDao.class 1KB
ssm-schema\target\classes\com\utils\CommonUtil.class 1KB
ssm-schema\target\classes\com\service\UserService.class 917B
ssm-schema\target\classes\com\utils\SQLFilter.class 873B
ssm-schema\target\classes\com\service\CommonService.class 710B
ssm-schema\target\classes\com\dao\CommonDao.class 698B
ssm-schema\target\classes\com\annotation\IgnoreAuth.class 428B
ssm-schema\target\classes\com\annotation\APPLoginUser.class 395B
ssm-schema\target\classes\com\annotation\LoginUser.class 389B
ssm-schema\.classpath 1KB
ssm-schema\.settings\org.eclipse.wst.common.component 689B
ssm-schema\.settings\org.eclipse.wst.jsdt.ui.superType.container 49B
ssm-schema\src\main\webapp\admin\dist\css\app.cfa97989.css 242KB
assets\css\elementui.css 227KB
assets\css\icons.css 159KB
ssm-schema\src\main\webapp\resources\bootstrap\css\bootstrap.css 143KB
assets\css\relys\bootstrap.min.css 138KB
assets\css\tableft.css 135KB
assets\css\relys\style.css 125KB
ssm-schema\src\main\webapp\resources\bootstrap\css\bootstrap.min.css 118KB
assets\css\relys\icofont.min.css 113KB
assets\css\original\bootstrap.min.css 108KB
assets\css\original\style.css 83KB
assets\css\relys\animate.css 79KB
layui\css\layui.css 73KB
assets\css\original\animate.css 72KB
assets\css\relys\all.min.css 45KB
ssm-schema\src\main\webapp\admin\dist\css\chunk-vendors.1f0a25b2.css 37KB
assets\css\original\font-awesome.min.css 34KB
assets\css\relys\swiper.min.css 19KB
assets\css\relys\lightcase.css 17KB
assets\css\original\jquery-ui.min.css 16KB
layui\css\modules\layer\default\layer.css 14KB
assets\css\original\swiper.min.css 13KB
layui\css\layui.mobile.css 10KB
assets\css\original\owl.carousel.css 8KB
assets\css\original\responsive.css 8KB
layui\css\modules\laydate\default\laydate.css 7KB
pages\address\style.css 4KB
assets\css\original\meanmenu.min.css 3KB
assets\css\relys\login.css 2KB
assets\css\original\slick.css 2KB
assets\css\original\xuanzuo.css 2KB
assets\css\relys\xuanzuo.css 2KB
pages\personal\style.css 2KB
pages\cart\style.css 1KB
layui\css\modules\code.css 1KB
layui\font\iconfont.eot 46KB
ssm-schema\src\main\webapp\resources\bootstrap\fonts\glyphicons-halflings-regular.eot 20KB
layui\images\face\59.gif 10KB
layui\images\face\22.gif 10KB
layui\images\face\24.gif 8KB
layui\images\face\13.gif 7KB
layui\images\face\16.gif 7KB
layui\images\face\39.gif 6KB
layui\images\face\64.gif 6KB
layui\images\face\63.gif 6KB
layui\images\face\50.gif 6KB
layui\css\modules\layer\default\loading-0.gif 6KB
layui\images\face\4.gif 6KB
layui\images\face\1.gif 5KB
layui\images\face\42.gif 5KB
layui\images\face\71.gif 5KB
layui\images\face\21.gif 5KB
layui\images\face\20.gif 5KB
layui\images\face\29.gif 5KB
layui\images\face\70.gif 4KB
layui\images\face\5.gif 4KB
layui\images\face\17.gif 4KB
layui\images\face\27.gif 4KB
layui\images\face\9.gif 4KB
layui\images\face\44.gif 4KB
layui\images\face\11.gif 4KB
layui\images\face\8.gif 4KB
layui\images\face\3.gif 4KB
layui\images\face\23.gif 4KB
layui\images\face\34.gif 4KB
layui\images\face\41.gif 4KB
layui\images\face\38.gif 4KB
layui\images\face\65.gif 3KB
layui\images\face\32.gif 3KB
共 800 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
学习开源项目成就精彩人生
- 粉丝: 1310
- 资源: 2604
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- sensors-18-03721.pdf
- Facebook.apk
- 推荐一款JTools的call-this-method插件
- json的合法基色来自红包东i请各位
- 项目采用YOLO V4算法模型进行目标检测,使用Deep SORT目标跟踪算法 .zip
- 针对实时视频流和静态图像实现的对象检测和跟踪算法 .zip
- 部署 yolox 算法使用 deepstream.zip
- 基于webmagic、springboot和mybatis的MagicToe Java爬虫设计源码
- 通过实时流协议 (RTSP) 使用 Yolo、OpenCV 和 Python 进行深度学习的对象检测.zip
- 基于Python和HTML的tb商品列表查询分析设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功