基于javaweb的SpringBoot学生管理系统(java+springboot+maven+mybatis+vue+mysql)

运行环境

Java≥8、MySQL≥5.7、Node.js≥14

开发工具

后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可

❗没学过node.js的不要搞前后端分离项目

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

310123062402

330123062402

340123062402

350123062402

360123062402

370123062402

基于javaweb的SpringBoot学生管理系统(java+springboot+maven+mybatis+vue+mysql)

一、项目简述

本系统功能包括: 学生管理,教师管理,课程管理,成绩管理,系统管理等等。

二、项目运行

环境配置:

Jdk1.8 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。

项目技术:

Springboot + Maven + mybatis+ Vue 等等组成,B/S模式 + Maven管理等等。

后端启动类:StartApplication
前端启动命令:npm run serve

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
 *
*/
@RestController
@RequestMapping("/stu-course")
public class StuCourseController {

@Autowired
private IStuCourseService iStuCourseService;

@GetMapping("/hello")
public String getHello(){
return "Hello";
}

@GetMapping("/get")
public HttpResponse getCourseList(NormalQueryInfo normalQueryInfo){
return HttpResponse.success(iStuCourseService.getCourseList(normalQueryInfo));
}

@GetMapping("/tags")
public HttpResponse getTeacherTags(@RequestParam(value = "courseId") Integer courseId){
return HttpResponse.success(iStuCourseService.getStuTeacherTagList(courseId));
}

@PostMapping("/add")
public HttpResponse addCourse(@RequestBody StuCourse stuCourse){
return HttpResponse.success(iStuCourseService.addCourse(stuCourse));
}

@PostMapping("/edit")
public HttpResponse editCourse(@RequestBody StuCourse stuCourse){
return HttpResponse.success(iStuCourseService.editCourse(stuCourse));
}

@DeleteMapping("/del")
public HttpResponse delCourse(@RequestBody StuCourse stuCourse){
return HttpResponse.success(iStuCourseService.delCourse(stuCourse));
}
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
public static Authentication getAuthenticationeFromToken(HttpServletRequest request) {
Authentication authentication = null;
// 获取请求携带的令牌
String token = JwtTokenUtils.getToken(request);
if(token != null) {
// 请求令牌不能为空
if(SecurityUtils.getAuthentication() == null) {
// 上下文中Authentication为空
Claims claims = getClaimsFromToken(token);
if(claims == null) {
return null;
}
String username = claims.getSubject();
if(username == null) {
return null;
}
if(isTokenExpired(token)) {
return null;
}
Object authors = claims.get(AUTHORITIES);
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
if (authors != null && authors instanceof List) {
for (Object object : (List) authors) {
authorities.add(new GrantedAuthorityImpl((String) ((Map) object).get("authority")));
}
}
authentication = new JwtAuthenticatioToken(username, null, authorities, token);
} else {
if(validateToken(token, SecurityUtils.getUsername())) {
// 如果上下文中Authentication非空,且请求令牌合法,直接返回当前登录认证信息
authentication = SecurityUtils.getAuthentication();
}
}
}
return authentication;
}

/**
* 从令牌中获取数据声明
*
* @param token 令牌
* @return 数据声明
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
/**
* <p>
* 学生信息 前端控制器
* </p>
*
*/
@RestController
@RequestMapping("/stu-info")
public class StuInfoController {


@Autowired
private IStuInfoService iStuInfoService;

/**
* 分页查询全部信息
* */
@GetMapping("/get")
public HttpResponse getPageStudentInfo(QueryStuInfoListRequest queryStuInfoListRequest){
return HttpResponse.success(iStuInfoService.getPageStudentInfo(
queryStuInfoListRequest.getPageNum(), queryStuInfoListRequest.getPageSize()
));
}

/**
* 对基本信息进行高级查询
* */
@GetMapping("/get-test")
public HttpResponse getPageStudentInfoByCondition(QueryStuInfoListRequest queryStuInfoListRequest){
iStuInfoService.getStudentInfoByCondition(queryStuInfoListRequest);
QueryListResponse<StuInfo> queryStuInfoListResponse = iStuInfoService.getStudentInfoByCondition(queryStuInfoListRequest);
//如果stuInfoListResponse.getNumOfTotalRecord() < 0 ,则表明输入类型和预期不符且发生异常,则返回错误
return queryStuInfoListResponse.getNumOfTotalRecord() < 0 ?
HttpResponse.error("输入信息类型错误!") : HttpResponse.success(queryStuInfoListResponse);
}

/**
* 添加学生信息
* */
@PostMapping("/add")
public HttpResponse addStudentInfo(@RequestBody StuInfo stuInfo){
String res = iStuInfoService.addStudentInfo(stuInfo);
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
     *
* @param token 令牌
* @return 是否过期
*/
public static Boolean isTokenExpired(String token) {
try {
Claims claims = getClaimsFromToken(token);
Date expiration = claims.getExpiration();
return expiration.before(new Date());
} catch (Exception e) {
return false;
}
}

/**
* 获取请求token
* @param request
* @return
*/
public static String getToken(HttpServletRequest request) {
String token = request.getHeader("Authorization");
String tokenHead = "Bearer ";
if(token == null) {
token = request.getHeader("token");
} else if(token.contains(tokenHead)){
token = token.substring(tokenHead.length());
}
if("".equals(token)) {
token = null;
}
return token;
}

}


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

/**
* <p>
* 教师个人详细信息 前端控制器
* </p>
*
*/
@RestController
@RequestMapping("/stu-teacher-info")
public class StuTeacherInfoController {

@Autowired
private IStuTeacherInfoService iStuTeacherInfoService;

@GetMapping("/get")
public HttpResponse getTeacherInfosList(NormalQueryInfo normalQueryInfo){
return HttpResponse.success(iStuTeacherInfoService.getTeacherInfosList(normalQueryInfo));
}

@PostMapping("/add")
public HttpResponse addTeacherInfosList(@RequestBody StuTeacherInfo stuTeacherInfo){
String res = iStuTeacherInfoService.addTeacherInfosList(stuTeacherInfo);
return res == null ? HttpResponse.success() : HttpResponse.error(res) ;
}

@PostMapping("/edit")
public HttpResponse editTeacherInfosList(@RequestBody StuTeacherInfo stuTeacherInfo){
return HttpResponse.success(iStuTeacherInfoService.editTeacherInfosList(stuTeacherInfo));
}

@DeleteMapping("/del")
public HttpResponse delTeacherInfosList(@RequestBody StuTeacherInfo stuTeacherInfo){
return HttpResponse.success(iStuTeacherInfoService.delTeacherInfosList(stuTeacherInfo));
}

@GetMapping("/remove-course-teacher")
public HttpResponse delCourse(@RequestParam("teacherId") Integer teacherId){
return HttpResponse.success(iStuTeacherInfoService.setCourseTeacherById(teacherId,-1));
}

@GetMapping("/get-no-course")
public HttpResponse getAllTeacherInfosListNoCourse(){
return HttpResponse.success(iStuTeacherInfoService.getAllTeacherInfosListNoCourse());
}

@GetMapping("/set-course")
public HttpResponse setCourseTeacher(@RequestParam(value = "teacherId") Integer teacherId,
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

/**
* <p>
* 成绩查询
* </p>
*
*/
@RestController
@RequestMapping("/stu-performance")
public class StuPerformanceController {

@Autowired
private IStuPerformanceService iStuPerformanceService;

/**
* 分页获取按照总分排序的总列表
*/
@GetMapping("/get")
public HttpResponse getStuPerformanceList(QueryStuPerformanceRequest queryStuPerformanceRequest){
return HttpResponse.success(iStuPerformanceService.getStuPerformanceList(queryStuPerformanceRequest));
}

/**
* 通过学号和姓名查询同学成绩
*/
@GetMapping("/get-student")
public HttpResponse getSingleStudentPerformance(@RequestParam(value = ConstName.NAME_COLUMN) String name,
@RequestParam(value = ConstName.NUMBER_COLUMN) Integer number){
return HttpResponse.success(iStuPerformanceService.getSingleStudentPerformance(name,number));
}

/**


项目链接:
https://javayms.github.io?id=051222062008200wf
https://javayms.pages.dev?id=051222062008200wf