演示视频:

基于springboot vue新生可视化报到管理系统源码

package com.zxy.controller;import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zxy.common.BindingResultUtil;
import com.zxy.common.ResultData;
import com.zxy.entity.College;
import com.zxy.service.ICollegeService;
import lombok.AllArgsConstructor;
import org.apache.ibatis.annotations.Delete;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;/*** <p>* 前端控制器* </p>** @author Zxy* @since 2023-05-11*/
@RestController
@RequestMapping("/college")
@AllArgsConstructor
public class CollegeController {private final ICollegeService collegeService;// 查询全部学院信息@GetMapping("/findall")public ResultData allCollege(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size) {Page<College> page = new Page<>(current, size);Page<College> collegePage = collegeService.page(page);if (collegePage != null) {return ResultData.success(collegePage);} else {return ResultData.fail("数据获取失败,请联系网站管理员");}}// 新增学院信息@PostMapping("/addcollege")public ResultData addCollege(@Validated @RequestBody College college, BindingResult result) {BindingResultUtil.validate(result);boolean save = collegeService.save(college);if (save) {return ResultData.success(save);} else {return ResultData.fail("保存失败,请联系网站管理员");}}// 根据id删除学院信息@DeleteMapping("/deletebyid")public ResultData deleteById(@RequestParam("id") Integer id) {boolean remove = collegeService.removeById(id);if (remove) {return ResultData.success(remove);} else {return ResultData.fail("保存失败,请联系网站管理员");}}// 根据id修改学院信息@PutMapping("/updatebyid")public ResultData updateById(@Validated @RequestBody College college, BindingResult result) {BindingResultUtil.validate(result);boolean update = collegeService.updateById(college);if (update) {return ResultData.success(update);} else {return ResultData.fail("保存失败,请联系网站管理员");}}}

package com.zxy.controller;import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.LineCaptcha;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zxy.common.BindingResultUtil;
import com.zxy.common.ResultData;
import com.zxy.dto.PersonCount;
import com.zxy.dto.SexCount;
import com.zxy.entity.Login;
import com.zxy.entity.Student;
import com.zxy.mapper.StudentMapper;
import com.zxy.service.IStudentService;
import com.zxy.utils.JWTUtils;
import lombok.AllArgsConstructor;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.UUID;/*** <p>* 前端控制器* </p>** @author Zxy* @since 2021-05-11*/
@RestController
@RequestMapping("/student")
@AllArgsConstructor
public class StudentController {private final IStudentService studentService;private final StudentMapper studentMapper;public static String code = "";// 添加学生(注册请求)@PostMapping("/add")public ResultData add(@Validated @RequestBody Student student, BindingResult result) {BindingResultUtil.validate(result);if (findByIdCard(student.getIdCard()) != null) {return ResultData.fail("学生已经存在,请勿重复添加");} else {String[] split = UUID.randomUUID().toString().split("-");// 注册时自动生成一卡通账号student.setCard(split[split.length - 1]);boolean save = studentService.save(student);if (save) {return ResultData.success(save);} else {return ResultData.fail("保存失败,请联系网站管理员");}}}// 根据学生身份证号查询,防止数据重复private Student findByIdCard(String card) {QueryWrapper<Student> wrapper = new QueryWrapper<>();wrapper.eq("id_card", card);return studentService.getOne(wrapper);}// 查询全部学生@GetMapping("/findlist")public ResultData findList(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size) {Page<Student> page = new Page<>(current, size);Page<Student> studentPage = studentService.page(page);if (studentPage != null) {return ResultData.success(studentPage);} else {return ResultData.fail("数据获取失败,请联系网站管理员");}}// 根据用户id查询用户@GetMapping("/findbyid")public ResultData findById(@RequestParam("id") Integer id) {QueryWrapper<Student> wrapper = new QueryWrapper<>();wrapper.eq("id", id);Student student = studentService.getOne(wrapper);if (student != null) {return ResultData.success(student);} else {return ResultData.fail("数据获取失败,请联系网站管理员");}}// 根据id修改学生信息@PutMapping("/updatebyid")public ResultData updateStudent(@Validated @RequestBody Student student, BindingResult result) {BindingResultUtil.validate(result);boolean update = studentService.updateById(student);if (update) {return ResultData.success(update);} else {return ResultData.fail("保存失败,请联系网站管理员");}}// 根据id删除学生信息@DeleteMapping("/deletebyid")public ResultData deleteById(@RequestParam("id") Integer id) {boolean remove = studentService.removeById(id);if (remove) {return ResultData.success(remove);} else {return ResultData.fail("保存失败,请联系网站管理员");}}// 管理员审核学生状态,携带学生id和状态id@GetMapping("/exam")public ResultData toExamine(@RequestParam("stuId") Integer stuId, @RequestParam("status") Integer status) {// 前端点击审核通过,发送id为1,更改数据库QueryWrapper<Student> wrapper = new QueryWrapper<>();wrapper.eq("id", stuId);Student student = studentService.getOne(wrapper);// 学生存在,更新状态if (student != null) {int i = studentService.stuExam(stuId, status);return ResultData.success(i);} else {return ResultData.fail("学生不存在");}}// 用户登录@PostMapping("/login")public ResultData login(@RequestBody Login login) {if (!login.getCode().equals(code)) {return ResultData.fail("验证码不正确,请检查后重新输入");}// 判断学生是否被激活QueryWrapper<Student> wrapper = new QueryWrapper<>();wrapper.eq("id_card", login.getIdCard());wrapper.eq("password", login.getPassword());Student stu = studentService.getOne(wrapper);// 验证登录用户是学生还是管理员if (stu == null) {return ResultData.fail("用户不存在,请检查后重新输入");} else {if (stu.getStatus() == 0) {return ResultData.fail("用户未激活,请联系管理员激活");} else {HashMap<String, String> map = new HashMap<>();map.put("id_card", login.getIdCard());String token = JWTUtils.getToken(map);stu.setToken(token);return ResultData.success(stu);}}}// 获取验证码@GetMapping("/code")public void code(HttpServletResponse response) throws IOException {LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 100);code = lineCaptcha.getCode();lineCaptcha.write(response.getOutputStream());}// 统计男女生人数@GetMapping("/countsex")public ResultData countSex() {List<SexCount> sexCounts = studentMapper.countBySexCount();return ResultData.success(sexCounts);}// 统计总人数@GetMapping("/countperson")public ResultData countPerson() {PersonCount count = studentMapper.personCount();return ResultData.success(count);}// 统计18-24之间人数比例@GetMapping("/eighteento")public ResultData countEight() {PersonCount count = studentMapper.eighteenToTwentyFour();return ResultData.success(count);}// 申请一卡通卡号@GetMapping("/applycard")public ResultData applyCard(@RequestParam("idCard") String idCard, @RequestParam("card") String card) {// 更新当前学生所持有一卡通信息状态int info = studentMapper.updateCardInfo(idCard, card);return ResultData.success(info);}
}

基于springboot vue新生可视化报到管理系统源码相关推荐

  1. 计算机毕业设计基于springboot+vue+elementUI的网吧管理系统(源码+系统+mysql数据库+Lw文档)

    项目介绍 随着我国的经济发展,人们的生活水平也有了一定程度的提高,对网络的要求也越来越高,很多家庭都有了自己的电脑,但是很多时候大家在家里玩电脑的时候找不到那种玩耍的气氛和氛围,这个时候大家就都选择了 ...

  2. 基于SpringBoot vue的电脑商城平台源码和论文含支付宝沙箱支付

    演示视频: 基于SpringBoot vue的电脑商城平台源码和论文含支付宝沙箱支付演示视频 支付宝沙箱: package com.java.controller;import java.util.* ...

  3. java计算机毕业设计基于springboot+vue+elementUI的旅游网站(源码+数据库+Lw文档)

    项目介绍 旅游管理平台采用B/S模式,促进了旅游管理平台的安全.快捷.高效的发展.传统的管理模式还处于手工处理阶段,管理效率极低,随着用户的不断增多,传统基于手工管理模式已经无法满足当前用户需求,随着 ...

  4. 基于SpringBoot vue的茶叶商城平台源码和论文含支付宝沙箱支付

    此项目是前后端分离的 后台项目:shop 前端项目:Vue-shop 后端项目启动步骤: 1.先把sql导入数据库 2.把后台项目导入编辑器 3.修改数据库配置 4.启动项目   前端项目启动步骤: ...

  5. 基于springboot vue elementui酒店预订系统源码(毕设)

    开发环境及工具: 大等于jdk1.8,大于mysql5.5,nodejs,idea(eclipse),vscode(webstorm) 技术说明: springboot mybatis vue ele ...

  6. springboot+vue宠物医院诊所管理系统源码

    开发环境及工具: 大等于jdk1.8,大于mysql5.5,idea(eclipse),nodejs,vscode(webstorm) 技术说明: springboot mybatis vue ele ...

  7. 基于springboot vue elementui新闻发布系统源码(毕设)

    开发环境及工具: 大等于jdk1.8,大于mysql5.5,nodejs,idea(eclipse),vscode(webstorm) 技术说明: springboot mybatis vue ele ...

  8. SpringBoot + Vue 的物流仓库管理系统源码

    主要框架 - SpringBoot - SpringData - SpringSecurity - Vue2 package com.example.api.controller;import com ...

  9. 基于Java毕业设计新生报到管理系统源码+系统+mysql+lw文档+部署软件

    基于Java毕业设计新生报到管理系统源码+系统+mysql+lw文档+部署软件 基于Java毕业设计新生报到管理系统源码+系统+mysql+lw文档+部署软件 本源码技术栈: 项目架构:B/S架构 开 ...

最新文章

  1. python字符串转日期_Python:将字符串时间字典转换为日期时间
  2. android 视频录制小例子,android 录制视频实例 VideoRecordDemo
  3. maven spring hibernate shiro
  4. VC调试选项说明:md /mdd /ml /mt/mtd
  5. SQL查询-巧用记录数统计人数
  6. 程序员代码面试指南——笔记1
  7. 行政区域村级划分数据库_最新行政区划省市区街道乡镇数据库 每月更新版
  8. ospf的五类LSA
  9. github加速脚本
  10. conda 解决An HTTP error occurred when trying to retrieve this URL.
  11. GoJS学习-节点渐变背景色
  12. 计算机中的CPU主频是单位,计算机CPU主频单位是MHz和GHz,他们之间怎么换算?
  13. mysql注入扫描网站漏洞工具_SQL注入漏洞扫描工具
  14. 海量数据去重的Hash与BloomFilter学习笔记
  15. 用html设计一个时间距离查询,使用HTML5 Geolocation实现一个距离追踪器
  16. 【Axure基础教程】第19章 树节点
  17. 计算机win10分区软件,如何利用Win10系统DiskPart工具进行GPT硬盘分区
  18. 向量代数与空间解析几何
  19. 小技巧——如何为foxmail中的文字编辑超链接
  20. .netCHATING 10.4 for NET6-7.0-Crack

热门文章

  1. 揭秘家用路由器0day漏洞挖掘技术原始环境搭建
  2. 上海多宁生物获近亿元A+轮融资,汇桥资本、药明生物投资...
  3. 网关、节点性能数据整理
  4. ae导出gif插件_GifGun v1.7.5 一键快速让AE导出输出GIF动态图脚本
  5. Java工作流引擎节点接收人设置“其他方式总结”系列讲解
  6. 矩阵乘以矩阵的转置的秩等于矩阵的秩
  7. m基于Simulink的高速跳频通信系统抗干扰性能分析
  8. 牛客OI周赛7-提高组 B小睿睿的询问(ST打表)
  9. autocad2016安装教程_CAD插件快速计算面积安装教程及资源链接
  10. Python使用网络抓包的方式,利用超级鹰平台识别验证码登录爬取古诗文网、上篇--识别验证码