文章目录
- 教务管理系统
- 一、项目演示
- 二、项目介绍
- 三、万字项目文档
- 四、部分功能截图
- 五、部分代码展示
- 六、底部获取项目源码和万字论文参考(9.9¥带走)
教务管理系统
一、项目演示
校务管理系统
二、项目介绍
基于springboot+vue的前后端分离教务管理系统
系统角色 : 系统管理员、科任老师、班主任、学生
系统管理员:管理系统用户、角色与权限,拥有查看班主任信息,学生基本信息,年级,班级,课程的管理,发布考试信息等。
科任老师:录入成绩,查看自己的个人信息。
班主任:可以查看本班成绩,本班学生信息。
学生:查看自己成绩,自己信息
项目技术
语言:java
前端技术:Vue、 ELementUI
后端技术:SpringBoot、Mybatis-Plus
数据库:MySQL
三、万字项目文档
四、部分功能截图
五、部分代码展示
package com.ljxy.score.controller;import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ljxy.score.common.Result;
import com.ljxy.score.entity.Clazz;
import com.ljxy.score.entity.Grade;
import com.ljxy.score.entity.Student;
import com.ljxy.score.entity.User;
import com.ljxy.score.service.ClazzService;
import com.ljxy.score.service.GradeService;
import com.ljxy.score.service.StudentService;
import com.ljxy.score.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;import javax.annotation.Resource;
import java.util.List;@Api(tags = "班级模块")
@RestController
@RequestMapping("/clazz")
public class ClazzController {@ResourceClazzService clazzService;@ResourceGradeService gradeService;@ResourceStudentService studentService;@ResourceUserService userService;@ApiOperation(value = "全部年级")@GetMapping("/all")public Result<?> getAllClazz() {List<Clazz> list = clazzService.list();return Result.success(list);}@ApiOperation(value = "分页查询(班级管理)")@GetMapping("/list")public Result<?> page(@RequestParam(defaultValue = "1") Integer PageNum, @RequestParam(defaultValue = "10") Integer PageSize, @RequestParam(defaultValue = "") String search) {LambdaQueryWrapper<Clazz> wrapper = Wrappers.<Clazz>lambdaQuery();if (StrUtil.isNotBlank(search)) wrapper.like(Clazz::getName, search);Page<Clazz> clazzPage = clazzService.findPage(new Page<>(PageNum, PageSize), search);return Result.success(clazzPage);}@ApiOperation(value = "添加班级")@PostMapping("/add")public Result<?> addClazz(@RequestBody Clazz clazz) {Grade one = gradeService.getOne(Wrappers.<Grade>lambdaQuery().eq(Grade::getId, clazz.getGradeId()));String GradeName = one.getName();Clazz result = clazzService.getOne(Wrappers.<Clazz>lambdaQuery().eq(Clazz::getId, clazz.getId()));Clazz res = clazzService.getOne(Wrappers.<Clazz>lambdaQuery().eq(Clazz::getName, clazz.getName()).eq(Clazz::getGradeId, clazz.getGradeId()));System.out.println("res = " + res);System.out.println("result = " + result);if (res != null) return Result.error("-1", GradeName+clazz.getName()+"已存在");if (result != null) return Result.error("-2", "编号已存在");clazzService.save(clazz);System.out.println(clazz);return Result.success(clazz);}@ApiOperation(value = "删除班级")@ApiImplicitParam(name = "id", value = "班级编号", required = true)@DeleteMapping("/delete/{id}")public Result<?> deleteClazz(@PathVariable Long id) {Integer gradeId = clazzService.getById(id).getGradeId();List<Student> list = studentService.list(Wrappers.<Student>lambdaQuery().eq(Student::getClazzId, id).eq(Student::getGradeId, gradeId));for (int i = 0; i < list.size(); i++) {userService.remove(Wrappers.<User>lambdaQuery().eq(User::getAccount,list.get(i).getStuId()));}if (clazzService.removeById(id)) return Result.success();return Result.error("-1", "删除失败");}@ApiOperation(value = "修改班级")@PutMapping("/update")public Result<?> update(@RequestBody Clazz clazz) {if (clazzService.updateById(clazz)) return Result.success();return Result.error("-1", "修改失败");}@ApiOperation(value = "根据年级ID查询班级")@GetMapping("/findClazzByGid")public Result<?> findByGid(Integer gradeId) {List<Clazz> res = clazzService.findClazz(gradeId);return Result.success(res);}@ApiOperation(value = "查id")@GetMapping("/findid")public void getById(String name, Integer gradeId) { /* Integer res = gradeMapper.selectGrade(name); System.out.println(res);*/Integer id = clazzService.findId(name, gradeId);System.out.println(id);}
}
package com.ljxy.score.controller;import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ljxy.score.common.Result;
import com.ljxy.score.entity.Escore;import com.ljxy.score.entity.Vo.ClazzAvgVo;import com.ljxy.score.service.EscoreService;import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;import javax.annotation.Resource;
import java.util.List;/*** @author SuSheng* @date 2022/3/3 16:25*/@Api(tags = "成绩模块")
@RestController
@RequestMapping("/escore")
public class EscoreController {@ResourceEscoreService escoreService;@ApiOperation("查询学生成绩")@GetMapping("/studentscore")public Result<?> studentScoreList(Integer examId, Integer studentId) {List<Escore> scoreList = escoreService.selectScore(examId, studentId, null, null, null);return Result.success(scoreList);}@ApiOperation("管理员查看学生成绩")@GetMapping("/admin/student/score")public Result<?> adminScore(@RequestParam(defaultValue = "1") Integer PageNum, @RequestParam(defaultValue = "10") Integer PageSize,Integer examId, Integer studentId, Integer courseId, Integer clazzId){Page<Escore> page = escoreService.findPage(new Page<>(PageNum, PageSize), examId, studentId,null, clazzId, courseId);return Result.success(page);}/*** 查询学生成绩(老师)** @param PageNum* @param PageSize* @param examId* @param clazzId* @param gradeId* @param courseId* @return*/@ApiOperation("老师查询学生成绩")@GetMapping("/teacherscore")public Result<?> teacherScoreList(@RequestParam(defaultValue = "1") Integer PageNum, @RequestParam(defaultValue = "10") Integer PageSize, Integer examId, Integer clazzId, Integer gradeId, Integer courseId,Integer studentId) {Page<Escore> page = escoreService.findPage(new Page<>(PageNum, PageSize), examId, studentId, gradeId, clazzId, courseId);return Result.success(page);}/*** 修改学生成绩** @param escore* @return*/@ApiOperation("修改学生成绩")@PutMapping("/update")public Result<?> updateExamScore(@RequestBody Escore escore) {if (escoreService.updateById(escore)) {return Result.success();}return Result.error("-1", "修改失败");}/*** 导入学生成绩*/@ApiOperation("导入学生成绩")@PostMapping("/upload")public Result<?> importScore(MultipartFile file, Integer examId, Integer gradeId, Integer clazzId, Integer courseId) {System.out.println(examId);System.out.println(gradeId);System.out.println(clazzId);System.out.println(courseId);ImportParams params = new ImportParams();params.setTitleRows(0);try {List<Escore> list = ExcelImportUtil.importExcel(file.getInputStream(), Escore.class, params);list.forEach(escore -> {System.out.println(escore);
// 查找学生成绩对应的idList<Escore> escores = escoreService.selectScore(examId, escore.getStudentId(), gradeId, clazzId, courseId);System.out.println(escores);Integer escoreId = escores.get(0).getId();System.out.println("成绩id"+escoreId);escoreService.updateScore(escoreId, escore.getScore());});return Result.success();} catch (Exception e) {e.printStackTrace();}return Result.error("-1", "上传失败");}@ApiOperation("查询考试平均分")@GetMapping("/clazzavg")public Result<?> test(Integer examId,Integer gradeId,Integer clazzId,Integer courseId){float v = escoreService.selectAvg(examId,gradeId,clazzId,courseId);System.out.println(v);return Result.success(v);}@ApiOperation("各班平均分")@GetMapping("/test")public Result<?> result(Integer examId,Integer gradeId,Integer courseId){List<ClazzAvgVo> clazzAvgVos = escoreService.clazzAvg(examId, gradeId, courseId);return Result.success(clazzAvgVos);}@ApiOperation("最高分")@GetMapping("/height/score")public Result<?> heightScore(Integer examId,Integer gradeId,Integer courseId,Integer clazzId){float score = escoreService.heightScore(examId, gradeId, courseId,clazzId);return Result.success(score);}}
package com.ljxy.score.controller;import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ljxy.score.common.Result;
import com.ljxy.score.entity.*;
import com.ljxy.score.entity.Vo.GradecountVo;
import com.ljxy.score.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;import javax.annotation.Resource;
import java.util.List;/*** @author SuSheng* @date 2022/3/2 0:30*/
@Api(tags = "考试模块")
@RestController
@RequestMapping("/exam")
public class ExamController {@ResourceExamService examService;@ResourceGradeCourseService gradeCourseService;@ResourceStudentService studentService;@ResourceEscoreService escoreService;/*** 删除考试** @param id* @return*/@ApiOperation(value = "删除考试")@DeleteMapping("/delete/{id}")public Result<?> deleteExam(@PathVariable Long id) {if (examService.removeById(id)) return Result.success();return Result.error("-1", "删除失败");}/*** 分页查询考试成绩** @param PageNum* @param PageSize* @param name* @param gradeId* @return*/@ApiOperation(value = "考试信息(分页)")@GetMapping("/all")public Result<?> ExamList(@RequestParam(defaultValue = "1") Integer PageNum, @RequestParam(defaultValue = "10") Integer PageSize, String name, Integer gradeId) {System.out.println(name);System.out.println(gradeId);Page<Exam> list = examService.examPage(new Page<>(PageNum, PageSize), name, gradeId);return Result.success(list);}/*** 修改考试信息** @param exam* @return*/@ApiOperation(value = "修改考试信息")@PutMapping("/update")public Result<?> updateExam(@RequestBody Exam exam) {if (examService.updateById(exam)) {return Result.success(exam);}return Result.error("-1", "更新失败");}/*** 修改年级状态** @param id* @param status* @return*/@ApiOperation("修改考试状态")@PutMapping("/updateStatus")public Result<?> updateStatus(Integer id, Integer status) {System.out.println("考试ID" + id);System.out.println("考试状态" + status);examService.updateStatus(id, status);return Result.success();}/*** 添加考试* 初始化学生成绩信息*/@ApiOperation(value = "添加考试")@PostMapping("/add")public Result<?> addExamAndInfo(@RequestBody Exam exam) {
// 设置考试状态为不可见Exam one = examService.getOne(Wrappers.<Exam>lambdaQuery().eq(Exam::getId, exam.getId()));if(one !=null){return Result.error("-2","编号重复");}exam.setStatus(0);if (examService.save(exam)) {// 年级idInteger gradeId = exam.getGradeId();// 根据年级查询课程List<GradeCourse> gradeCourseList = gradeCourseService.list(Wrappers.<GradeCourse>lambdaQuery().eq(GradeCourse::getGradeId, gradeId));// 查询年级学生List<Student> studentList = studentService.list(Wrappers.<Student>lambdaQuery().eq(Student::getGradeId, gradeId));for (int i = 0; i < gradeCourseList.size(); i++) {for (int j = 0; j < studentList.size(); j++) {Escore escore = new Escore();escore.setExamId(exam.getId());escore.setGradeId(exam.getGradeId());escore.setClazzId(studentList.get(j).getClazzId());escore.setCourseId(gradeCourseList.get(i).getCourseId());escore.setStudentId(studentList.get(j).getId());escoreService.save(escore);}}return Result.success();}return Result.error("-1", "添加失败");}/*** 查询各年级考试次数*/@ApiOperation("查询各年级考试次数")@GetMapping("/count")public Result<?> examCount(){List<GradecountVo> gradecountVos = examService.examCount();return Result.success(gradecountVos);}
}
六、底部获取项目源码和万字论文参考(9.9¥带走)
有问题,或者需要协助调试运行项目的也可以