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.YuangongEntity;
import com.entity.view.YuangongView;
import com.service.YuangongService;
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-29 16:24:23
*/
@RestController
@RequestMapping("/yuangong")
public class YuangongController {
@Autowired
private YuangongService yuangongService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
YuangongEntity user = yuangongService.selectOne(new EntityWrapper<YuangongEntity>().eq("gonghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(), username,"yuangong", "员工" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody YuangongEntity yuangong){
//ValidatorUtils.validateEntity(yuangong);
YuangongEntity user = yuangongService.selectOne(new EntityWrapper<YuangongEntity>().eq("gonghao", yuangong.getGonghao()));
if(user!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
yuangong.setId(uId);
yuangongService.insert(yuangong);
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");
YuangongEntity user = yuangongService.selectById(id);
return R.ok().put("data", user);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
YuangongEntity user = yuangongService.selectOne(new EntityWrapper<YuangongEntity>().eq("gonghao", username));
if(user==null) {
return R.error("账号不存在");
}
user.setMima("123456");
yuangongService.updateById(user);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,YuangongEntity yuangong,
HttpServletRequest request){
EntityWrapper<YuangongEntity> ew = new EntityWrapper<YuangongEntity>();
PageUtils page = yuangongService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yuangong), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,YuangongEntity yuangong,
HttpServletRequest request){
EntityWrapper<YuangongEntity> ew = new EntityWrapper<YuangongEntity>();
PageUtils page = yuangongService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yuangong), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( YuangongEntity yuangong){
EntityWrapper<YuangongEntity> ew = new EntityWrapper<YuangongEntity>();
ew.allEq(MPUtil.allEQMapPre( yuangong, "yuangong"));
return R.ok().put("data", yuangongService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(YuangongEntity yuangong){
EntityWrapper< YuangongEntity> ew = new EntityWrapper< YuangongEntity>();
ew.allEq(MPUtil.allEQMapPre( yuangong, "yuangong"));
YuangongView yuangongView = yuangongService.selectView(ew);
return R.ok("查询员工成功").put("data", yuangongView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
YuangongEntity yuangong = yuangongService.selectById(id);
return R.ok().put("data", yuangong);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
YuangongEntity yuangong = yuangongService.selectById(id);
return R.ok().put("data", yuangong);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody YuangongEntity yuangong, HttpServletRequest request){
yuangong.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yuangong);
YuangongEntity user = yuangongService.selectOne(new EntityWrapper<YuangongEntity>().eq("gonghao", yuangong.getGonghao()));
if(user!=null) {
return R.error("用户已存在");
}
yuangong.setId(new Date().getTime());
yuangongService.insert(yuangong);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody YuangongEntity yuangong, HttpServletRequest request){
yuangong.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yuangong);
YuangongEntity user = yuangongService.selectOne(new EntityWrapper<YuangongEntity>().eq("gonghao", yuangong.getGonghao()));
if(user!=null) {
return R.error("用户已存在");
}
yuangong.setId(new Date().getTime());
yuangongService.insert(yuangong);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody YuangongEntity yuangong, HttpServletRequest request){
//ValidatorUtils.validateEntity(yuangong);
yuangongService.updateById(yuangong);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
yuangongService.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 re
没有合适的资源?快使用搜索试试~ 我知道了~
基于Springboot+Vue的中小企业设备管理系统的设计与实现
共469个文件
java:162个
svg:161个
vue:56个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 191 浏览量
2024-09-15
14:04:33
上传
评论
收藏 7.99MB RAR 举报
温馨提示
【基于Springboot+Vue的中小企业设备管理系统的设计与实现】高分通过项目,已获导师指导。 本项目是一套基于Springboot+Vue的中小企业设备管理系统,主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的Java学习者。也可作为课程设计、期末大作业 包含:项目源码、数据库脚本、开发说明文档、部署视频、代码讲解视频、全套软件等,该项目可以直接作为毕设使用。 项目都经过严格调试,确保可以运行!
资源推荐
资源详情
资源评论
收起资源包目录
基于Springboot+Vue的中小企业设备管理系统的设计与实现
(469个子文件)
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 2KB
mvnw.cmd 7KB
app.7b77bc95.css 255KB
chunk-vendors.0fdd4e14.css 37KB
.factorypath 15KB
.gitignore 364B
index.html 924B
index.html 552B
favicon.ico 4KB
favicon.ico 4KB
maven-wrapper.jar 50KB
YuangongController.java 9KB
YonghuController.java 9KB
CommonController.java 8KB
ShebeianzhuangController.java 7KB
ShouhoubaoyangController.java 7KB
ShouhoujianxiuController.java 7KB
ShebeidianjianController.java 7KB
PeijiangoumaiController.java 7KB
ShiwubaojingController.java 7KB
ShebeigaizaoController.java 7KB
ShebeirunhuaController.java 7KB
ShebeigoumaiController.java 7KB
ShebeibaoxiuController.java 7KB
ShebeileixingController.java 7KB
PeijianxinxiController.java 7KB
ShebeixinxiController.java 6KB
ShebeianzhuangEntity.java 5KB
ShouhoujianxiuEntity.java 5KB
MPUtil.java 5KB
UserController.java 5KB
PeijiangoumaiEntity.java 5KB
ShebeigoumaiEntity.java 5KB
MavenWrapperDownloader.java 5KB
ShouhoubaoyangEntity.java 5KB
ShebeibaoxiuEntity.java 5KB
ShebeixinxiEntity.java 5KB
ShebeigaizaoEntity.java 4KB
ShebeirunhuaEntity.java 4KB
ShebeidianjianEntity.java 4KB
ShebeianzhuangModel.java 4KB
PeijianxinxiEntity.java 4KB
ShouhoujianxiuModel.java 4KB
ShebeianzhuangVO.java 4KB
ShouhoujianxiuVO.java 4KB
ShiwubaojingEntity.java 4KB
PeijiangoumaiModel.java 4KB
ShebeigoumaiModel.java 4KB
YuangongEntity.java 4KB
ShouhoubaoyangModel.java 4KB
PeijiangoumaiVO.java 4KB
ShebeigoumaiVO.java 4KB
ShouhoubaoyangVO.java 4KB
BaiduUtil.java 4KB
FileController.java 4KB
YonghuEntity.java 3KB
ShebeibaoxiuModel.java 3KB
ShebeixinxiModel.java 3KB
ShebeixinxiVO.java 3KB
ShebeibaoxiuVO.java 3KB
AuthorizationInterceptor.java 3KB
ShebeigaizaoModel.java 3KB
ShebeirunhuaModel.java 3KB
ShebeigaizaoVO.java 3KB
ShebeirunhuaVO.java 3KB
ConfigController.java 3KB
ShebeidianjianModel.java 3KB
ShebeidianjianVO.java 3KB
PeijianxinxiModel.java 3KB
PeijianxinxiVO.java 3KB
ShiwubaojingModel.java 3KB
Query.java 3KB
YuangongModel.java 3KB
ShiwubaojingVO.java 3KB
YuangongVO.java 2KB
TokenServiceImpl.java 2KB
YonghuModel.java 2KB
YonghuVO.java 2KB
TokenEntity.java 2KB
ShouhoujianxiuServiceImpl.java 2KB
ShouhoubaoyangServiceImpl.java 2KB
ShebeianzhuangServiceImpl.java 2KB
ShebeidianjianServiceImpl.java 2KB
ShebeileixingServiceImpl.java 2KB
PeijiangoumaiServiceImpl.java 2KB
ShebeileixingEntity.java 2KB
ShebeigoumaiServiceImpl.java 2KB
ShebeirunhuaServiceImpl.java 2KB
ShiwubaojingServiceImpl.java 2KB
PeijianxinxiServiceImpl.java 2KB
ShebeigaizaoServiceImpl.java 2KB
ShebeibaoxiuServiceImpl.java 2KB
PageUtils.java 2KB
共 469 条
- 1
- 2
- 3
- 4
- 5
资源评论
Java骨灰级码农
- 粉丝: 4408
- 资源: 755
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- python的函数的基本用法学习包
- f13b0fd5eq9352b28b6309177764c804.apk
- x64WinQSB安装程序v4.1
- 2023-04-06-项目笔记 - 第二百八十四阶段 - 4.4.2.282全局变量的作用域-282 -2025.10.12
- 数据集-目标检测系列- 降落伞 滑翔机 检测数据集 glider >> DataBall
- 数据集-目标检测系列- 战斗机 检测数据集 fighter-plane >> DataBall
- mybatis-plus代码生成自定义templates
- 数据集-目标检测系列- 手提包 检测 检测数据集 hand bag>> DataBall
- 数据集-目标检测系列- 手表 腕表 检测数据集 wristwatch >> DataBall
- 自动化车间安全生产服务的标准制定与应用指南
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功