——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot前台+后台在线考试系统设计和实现(java+springboot+ssm+mysql+thymeleaf+html+maven)
一、项目简述
本系统主要实现的功能有: 学生以及老师的注册登录,在线考试,错题查询,学生管理,问题管理,错题管理,错题查询,分数查询,试卷管 理,人工组卷。自动组卷,教师,班级,统计等等管理功能。
二、项目运行
环境配置: Jdk1.8 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: Springboot+ SpringMVC + MyBatis + ThymeLeaf + JavaScript + JQuery + Ajax + 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 }else { result.setSuccess(false ); } return result; } @RequestMapping("/index") public String index (Model model) { int teas=teacherService.queryCountAll(); int stus=studentService.queryCOuntALlstu(); int alllogers=teas+stus; int allQues=questionService.queryCountAllQues(); int allPaps=paperService.queryCountALlPaps(); List<Record> ScoreHStu=recordService.queryRankScoreRecord(); List<Record> AccHStu=recordService.queryRankAccRecord(); model.addAttribute("ScoreHStu" ,ScoreHStu); model.addAttribute("AccHStu" ,AccHStu); model.addAttribute("allPaps" ,allPaps); model.addAttribute("allQues" ,allQues); model.addAttribute("alllogers" ,alllogers); return "index" ; } @ResponseBody @RequestMapping("/foreCheck/check") public Object foreCheck (Student student, HttpServletRequest request) { AjaxResult result=new AjaxResult(); HttpSession session=request.getSession(); Student stud=studentService.check(student); if (stud!=null ){ session.setAttribute("loger" ,stud); result.setSuccess(true ); }else { result.setSuccess(false ); } return result; }
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 @RequestMapping("/getAllTeacher") public String getAllTeacher (Model model) { List<Teacher> teachers = teacherService.getAll(); List<Classe> classes=classeService.queryAllTeacherId(); List<Integer> teaId=new ArrayList<>(); for (Classe cla:classes){ teaId.add(cla.getTeacherId()); } model.addAttribute("teaId" ,teaId); model.addAttribute("teachers" ,teachers); return "teacher/teacherList" ; } @RequestMapping("/toAddTeacher") public String toAddTeacher () { return "teacher/teacherAdd" ; } @RequestMapping("/addTeacher") public String addTeacher (Teacher teacher) { int teacherId = teacher.getTeacherId(); if (teacherId==0 ){ teacherService.addTeacher(teacher); }else { teacherService.editTeacher(teacher); } return "redirect:/teacher/getAllTeacher" ; } @RequestMapping("/{id}") public String toEditTeacher (@PathVariable("id") Integer id,Model model) { Teacher teacher=teacherService.getTeacherById(id); model.addAttribute("teacher" ,teacher); return "teacher/teacherAdd" ; } @RequestMapping("/deleteTeacher/{id}") public String deleteTeacherById (@PathVariable("id") Integer id,Model model) { teacherService.deleteTeacherById(id); return "redirect:/teacher/getAllTeacher" ; } } package com.zhao.quiz.controller;
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 @Controller @RequestMapping("/classe") public class ClasseController { @Autowired private ClasseService classeService; @Autowired private TeacherService teacherService; @RequestMapping("/getAllClasse") public String getAllClasse (Model model) { List<Classe> classes = classeService.getAll(); model.addAttribute("classes" ,classes); return "classe/classeList" ; } @RequestMapping("/toAddClasse") public String toAddClasse (Model model) { List<Teacher> teachers=teacherService.queryTeacherNotAdvisor(); model.addAttribute("teachers" ,teachers); return "classe/classeAdd" ; } @RequestMapping("/addClasse") public String addClasse (Classe classe) { classeService.addClasse(classe); return "redirect:/classe/getAllClasse" ; } @RequestMapping("/toEditClasse/{id}") public String toEditClasse (@PathVariable("id") Integer id,Model model) { Classe classe=classeService.getClasseById(id); int teacherIdd=classe.getTeacherId(); Teacher teacherold=teacherService.getTeacherById(teacherIdd); List<Teacher> teachers=teacherService.queryTeacherNotAdvisor(); teachers.add(teacherold);
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 model.addAttribute("questionCourseresRes" ,questionCourseresRes); model.addAttribute("questionTypesRes" ,questionTypesRes); model.addAttribute("questionTypes" ,questionTypes); model.addAttribute("questionCourses" ,questionCourses); model.addAttribute("pageInfo" ,pageInfo); model.addAttribute("paperId" ,paperId); return "paper/AddQuestion" ; } @RequestMapping("/AddQuestion") public String AddQuestion (Integer paperId,Integer quesId,Integer pageNum,String questionCourse,String questionType) { QuestionPaper questionPaper=new QuestionPaper(quesId,paperId); paperService.AddQuestionToPaperById(questionPaper); return "redirect:/paper/toAddQuestion/" +paperId+"?pageNum=" +pageNum+"&questionCourse=" +questionCourse+"&questionType=" +questionType; } @RequestMapping("/detachQuestion") public String detachQuestion (Integer qpId,Integer paperId) { paperService.detachQuestionById(qpId); return "redirect:/paper/toManagerQuestion/" +paperId; } @RequestMapping("/toRandomQuestion/{id}") public String toRandomQuestion (@PathVariable ("id" ) Integer papid,Question question,Model model) { List<Question> questionCourses=questionService.queryAllCourse(); questionCourses.add(new Question("bug" ,"all" )); int TotalQuestionNums=questionService.queryAllQuestionNums(); List<Map> maps = questionService.queryNumOfQuestionType(); List<String> course=new ArrayList<>(); List<Integer> count=new ArrayList<>(); for (Map map:maps){ for (Object key : map.keySet()) { if (map.get(key) instanceof String){ course.add(map.get(key).toString()); }else { count.add(Integer.parseInt(map.get(key).toString())); } } } Paper paperName=paperService.queryPaperNameById(papid); model.addAttribute("paperName" ,paperName.getPaperName()); model.addAttribute("count" ,count); model.addAttribute("course" ,course); model.addAttribute("TotalQuestionNums" ,TotalQuestionNums); model.addAttribute("paperId" ,papid);
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 paperService.editPaper(paper); return "redirect:/paper/getAllPaper" ; } @RequestMapping("/deletePaper/{id}") public String deletePaperById (@PathVariable("id") Integer id,Model model) { paperService.deletePaperById(id); return "redirect:/paper/getAllPaper" ; } @RequestMapping("/toManagerQuestion/{id}") public String toManagerQuestion (@PathVariable("id") Integer id,Model model) { List<QuestionPaper> questionPapers = paperService.paperQueryALlQuestionById(id); model.addAttribute("papid" ,id); Paper paperName=paperService.queryPaperNameById(id); model.addAttribute("paperName" ,paperName.getPaperName()); model.addAttribute("questionPapers" ,questionPapers); return "paper/ManagerQuestion" ; } @RequestMapping("/toAddQuestion/{id}") public String getAllQuestion (@PathVariable("id") Integer paperId,Question question,@RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "4") int pageSize, Model model) { List<Question> questionCourses=questionService.queryAllCourse(); questionCourses.add(new Question("bug" ,"all" )); List<Question> questionTypes=questionService.queryAllType(); questionTypes.add(new Question("k" ,"bug" )); String questionCourseBef = question.getQuestionCourse(); String questionCourseresRes="" ; if (questionCourseBef==null ){ questionCourseresRes="all" ; }else { questionCourseresRes=questionCourseBef; } String questionTypeBef=question.getQuestionType(); String questionTypesRes="" ; if (questionTypeBef==null ){ questionTypesRes="k" ; }else { questionTypesRes=questionTypeBef; } List<Question> questionids=paperService.queryALlQuestionIdInPaperById(paperId); List<Integer> quesds=new ArrayList<>(); if (questionids!=null ){ for (Question qid:questionids){ quesds.add(qid.getQuestionId());
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 int nums=questionService.queryIdByPapQue(ques); return "redirect:/paper/toManagerQuestion/" +papid; } } package com.zhao.quiz.controller;@Controller @RequestMapping("/exam") public class ExamController { @Autowired private ExamService examService; @Autowired private PaperService paperService; @Autowired private RecordService recordService; @RequestMapping("/toExam") public String toExam (Model model) { List<Exam> Exams = examService.getAll(); model.addAttribute("Exams" ,Exams); return "exam/examplan" ;
——————————PayStart——————————
项目链接: https://javayms.github.io?id=571422302105200hg https://javayms.pages.dev?id=571422302105200hg