——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Node.js≥14
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
❗没学过node.js的不要搞前后端分离项目
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于javaweb的SpringBoot基于遗传算法学校排课系统(java+springboot+maven+mybatis+vue+mysql+oss)
一、项目简述本系统功能包括: 排课管理,课程管理,讲师管理,班级管理,学生管理,教学资料,学习文档,在线测试,教材列表,教学设计,帮助中心等等功能。
二、项目运行 环境配置:
Jdk1.8 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。
项目技术:
Springboot + Maven + mybatis+ Vue 等等组成,B/S模式 + Maven管理等等。
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| public ServerResponse studentRegister(@RequestBody StudentRegisterRequest stu) { System.out.println(stu); Student student = new Student(); student.setStudentNo(stu.getStudentNo()); student.setUsername(stu.getUsername()); student.setPassword(stu.getPassword()); student.setRealname(stu.getRealname()); student.setGrade(stu.getGrade()); student.setAddress(stu.getAddress()); student.setTelephone(stu.getTelephone()); student.setEmail(stu.getEmail()); boolean b = studentService.save(student); if (b) { return ServerResponse.ofSuccess("注册成功", student); } return ServerResponse.ofError("注册失败!"); }
@PostMapping("/modify") @UserLoginToken public ServerResponse modifyStudent(@RequestBody Student student) { return studentService.updateById(student) ? ServerResponse.ofSuccess("修改成功") : ServerResponse.ofError("修改失败"); }
@GetMapping("/{id}") @UserLoginToken public ServerResponse queryStudent(@PathVariable("id")Integer id){ return ServerResponse.ofSuccess(studentService.getById(id)); }
@PostMapping("/modify/{id}") public ServerResponse modifyTeacher(@PathVariable("id") Integer id, @RequestBody Student student) {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| */ @PostMapping("/join/{id}/{classNo}") public ServerResponse joinClass(@PathVariable("id") Integer id, @PathVariable("classNo") String classNo) { Student student = studentService.getById(id); student.setClassNo(classNo); boolean b = studentService.saveOrUpdate(student); if (b) { return ServerResponse.ofSuccess("加入班级成功"); } return ServerResponse.ofError("加入班级失败"); }
@PostMapping("/login") public ServerResponse studentLogin(@RequestBody StudentLoginRequest studentLoginRequest) { Map<String, Object> map = new HashMap<>(); QueryWrapper<Student> wrapper = new QueryWrapper<Student>().eq("student_no", studentLoginRequest.getUsername()); Student student2 = studentService.getOne(wrapper);
if (student2 == null) { return ServerResponse.ofError("学生账号不存在!");
}else if (student2.getStatus() != 0) { return ServerResponse.ofError("该学生账号异常,请联系管理员"); } Student student = studentService.studentLogin(studentLoginRequest.getUsername(), studentLoginRequest.getPassword()); if (student != null) { String token = tokenService.getToken(student); map.put("student", student); map.put("token", token); return ServerResponse.ofSuccess(map); } return ServerResponse.ofSuccess("密码错误!"); }
@PostMapping("/register") public ServerResponse studentRegister(@RequestBody StudentRegisterRequest stu) { System.out.println(stu);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| */ @GetMapping("/select/{id}") public ServerResponse queryTeachBuildingById(@PathVariable("id") Integer id) {
return ServerResponse.ofSuccess(teachBuildInfoService.getById(id)); }
@PostMapping("/modify/{id}") public ServerResponse modifyTeacher(@PathVariable("id") Integer id, @RequestBody TeachbuildInfo t) {
boolean b = teachBuildInfoService.update(t, new QueryWrapper<TeachbuildInfo>().eq("id", id));
if (b) { return ServerResponse.ofSuccess("更新成功"); } return ServerResponse.ofError("更新失败"); }
}
package com.lyk.coursearrange.common;
public class AuthenticationInterceptor implements HandlerInterceptor {
@Autowired
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| if (method.isAnnotationPresent(PassToken.class)) { PassToken passToken = method.getAnnotation(PassToken.class); if (passToken.required()) { return true; } }
if (method.isAnnotationPresent(UserLoginToken.class)) { UserLoginToken userLoginToken = method.getAnnotation(UserLoginToken.class); if (userLoginToken.required()) { if (token == null) { throw new RuntimeException("无token,请重新登录"); } String userId; try { userId = JWT.decode(token).getAudience().get(0); } catch (JWTDecodeException j) { throw new RuntimeException("401"); }
return true; } } return true; }
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable ModelAndView modelAndView) throws Exception {
}
@Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Teacher teacher = teacherService.getOne(wrapper); if (teacher == null) { return ServerResponse.ofError("旧密码错误"); } teacher.setPassword(passwordVO.getNewPass()); boolean b = teacherService.updateById(teacher); if (b) { return ServerResponse.ofSuccess("密码修改成功"); } return ServerResponse.ofError("密码更新失败"); }
@GetMapping("/all") public ServerResponse getAllTeacher() {
return ServerResponse.ofSuccess(teacherService.list()); }
}
package com.lyk.coursearrange.controller;
@RestController
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=031222062008200wd
https://javayms.pages.dev?id=031222062008200wd