基于springboot题库管理系统的设计与实现

   目前,许多高校绝大多数课程还采用考教统一的模式来完成教学过程,这种传统的考试模式在教学到实施考试的过程带有很大的主观随意性和不规范性。另外随着各高校近年来学生规模的扩大,教学任务日益繁重,教师的工作量相应的不断增加。迫切需要计算机辅助教学系统来打破这种传统的教学模式,减轻教师的工作负担,提高教学质量。因此,本文研究设计了一个试题库管理系统,来解决和缓解高校课程教学中现存的问题,提高教学质量和考试效果,减轻教师工作压力。试题库管理系统可辅助教师对所教科目的各种试题的题型、知识点、难度等相关资料进行保存、查询等信息管理;并在需要对学生进行测验、评估的时候,从题库中抽取出相应要求的题目,组成一套试卷。

试题库管理是学校工作的重要组成部分,如何快速有效合理的组卷和试题库完善的保管是所有教师和学校管理者共同高度关注的问题。大部分的题库管理系统很难保证试题的多样性、全面性和试卷难度的恰当分配。为了解决教师出题困难,帮助教师轻松的出一份高质量的试卷,所以开发试题库管理系统是非常必要的。

 本系统基于java的springboot开发框架,数据库采用mysql,开发工具采用idea进行设计,本文首先简要介绍了开发试题库管理系统的可行性分析,系统的需求分析和总体设计,然后主要针对系统的设计、组成、用户界面设计、程序设计进行了详细分析,并对系统部分关键性代码进行了讲解,同时对一般系统软件设计的基本思想及工作流程给出了方法技巧。首先在短时间内建立系统应用原型,然后,对初始原型系统进行需求迭代,不断修正和改进,直到形成用户满意的可行系统。

关键字:springboot  mybatis  题库管理 mysql数据库

目    录

1    

1.1 题目的来源及背景

1.2 研究意义

1.3 软件工程瀑布模型介绍

2  需求分析

2.1  项目内容及要求

2.1.1 具体完成功能

2.1.2 实现目标

2.2 可行性分析

2.2.1 经济可行性

2.2.2 技术可行性

2.3 开发工具的论述

2.3.1 前台开发工具

2.3.2 后台数据库

3  系统结构特性设计

3.1  系统分析模型

3.2  数据库设计

4  系统行为特性设计

4.1 软件结构设计

4.2功能子模块设计

4.2.1 教师登录模块

4.2.2 题库的管理与维护模块

4.2.3 试题查询模块

4.2.4 自动生成试卷模块

4.2.5 手工改动现有试卷模块

5 系统测试

5.1 系统测试方案

5.2 测试结果分析与调试

 

 

 

 

 

 

 yml配置:

spring:
  datasource:
    #    数据源基本配置
    username: root    #前面没有data直接是username或password
    password: root
    url: jdbc:mysql://localhost:3306/software?useUnicode=true&characterEncoding=utf-8&useSSL=false&&serverTimezone=Asia/Shanghai
    driver-class-name: com.mysql.cj.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource
    #   数据源其他配置
    initialSize: 5
    minIdle: 5
    maxActive: 20
    maxWait: 60000
    timeBetweenEvictionRunsMillis: 60000
    minEvictableIdleTimeMillis: 300000
    validationQuery: SELECT 1 FROM DUAL
    testWhileIdle: true
    testOnBorrow: false
    testOnReturn: false
    poolPreparedStatements: true
    #   配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
    filters: stat,wall  #,log4j
    maxPoolPreparedStatementPerConnectionSize: 20
    useGlobalDataSourceStat: true
    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
  #    schema:
  #      - classpath:sql/books.sql
  #    initialization-mode: always
  thymeleaf:
    prefix: classpath:/templates/
    cache: false
    suffix: .html
    encoding: UTF-8
    mode: HTML
    servlet:
      content-type: text/html
#开发时让无缓存

mybatis:
  type-aliases-package: com.zhao.quiz.domain
  config-location: classpath:mybatis/mybatis-config.xml
  mapper-locations: classpath:mybatis/mapper/*.xml

pagehelper:
  helper-dialect: mysql
  reasonable: true
  support-methods-arguments: true
  params: count=countSql

关键代码:

package com.zhao.quiz.controller;

import com.zhao.quiz.domain.*;
import com.zhao.quiz.service.ExamService;
import com.zhao.quiz.service.PaperService;
import com.zhao.quiz.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@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";
    }

    @RequestMapping("/toHist/{id}")
    public String toHist(@PathVariable ("id") Integer id,Model model){
        List<Record> records=recordService.queryAllExamById(id);
        model.addAttribute("records",records);
        return "exam/histplan";
    }

    //从其他页面跳转到home
    @RequestMapping("/toHome")
    public String tohome(){
        return "redirect:/indexprexam";
    }

    //来到对应考试页面
    @RequestMapping("/toDoExam/{id}")
    public String toDoExam(@PathVariable ("id") Integer id,Model model,String examId){
        List<QuestionPaper> questionPapers = paperService.paperQueryALlQuestionByIdOrderByType(id);
        int exId=Integer.parseInt(examId);
        Exam examById = examService.getExamById(exId);
        Paper paperName = paperService.queryPaperNameById(examById.getPaperId());
        model.addAttribute("paperName",paperName);
        model.addAttribute("examById",examById);
        model.addAttribute("questionPapers",questionPapers);
        return "exam/doExam";
    }

    //提交试卷
    @RequestMapping("/submitExam")
    public String submitExam(Integer paperId, Integer studentId, HttpServletRequest request){
        List<QuestionPaper> questionPapers = paperService.paperQueryALlQuestionByIdOrderByType(paperId);
        List<String> ans=new ArrayList<>();
        List<String> RightAns=new ArrayList<>();
        for (QuestionPaper qb:questionPapers){
            RightAns.add(qb.getQuestion().getQuestionOpright());
            String parameter="";
            String []parameters;
            if(qb.getQuestion().getQuestionType().equals("y")){
                parameters= request.getParameterValues("optionsSelect" + qb.getQuestionId());
                for(String s:parameters){
                    parameter+=s;
                }
            }else {
                parameter = request.getParameter("optionsSelect" + qb.getQuestionId());
            }
            ans.add(parameter);
        }
        //核对答案得到成绩
        int k=0;    //哨兵
        Double y=0.0;    //正确数
        int score=0;    //得分
        int a=0;        //记录单选题个数
        int b=0;        //记录多选题个数
        int c=0;        //记录判断题个数
        int totalScore=0;
        for (QuestionPaper qb:questionPapers){
            //若为单选题则正确+单选题分数
            if(qb.getQuestion().getQuestionType().equals("x")){
                if(ans.get(k).equals(RightAns.get(k))){
                    score+=qb.getPaper().getScoreSin();
                    y++;
                }
                a++;
                k++;
            }else if(qb.getQuestion().getQuestionType().equals("y")){
                if(ans.get(k).equals(RightAns.get(k))){
                    score+=qb.getPaper().getScoreChe();
                    y++;
                }
                b++;
                k++;
            }else {
                if(ans.get(k).equals(RightAns.get(k))){
                    score+=qb.getPaper().getScoreJug();
                    y++;
                }
                c++;
                k++;
            }
        }
        int scoreSin1 = questionPapers.get(0).getPaper().getScoreSin();
        int scoreChe1 = questionPapers.get(0).getPaper().getScoreChe();
        int scoreJug1 = questionPapers.get(0).getPaper().getScoreJug();
        int bool=recordService.queryBooleanToscore(paperId);
        if (bool==0){
        totalScore=scoreSin1*a+scoreChe1*b+scoreJug1*c; //得到每张试卷总分
        Toscore toscore=new Toscore();
        toscore.setPaperId(paperId);
        toscore.setToscore(totalScore);
        recordService.AddToScore(toscore);
        }
        //保存答题记录
        String answer = String.join(",", ans);
        Paper paper = paperService.queryPaperNameById(paperId);
        String paperName = paper.getPaperName();
        Double recordAcc=y/k;
        int recordScore=score;
        Record record=new Record();
        record.setRecordName(paperName);
        record.setStudentId(studentId);
        record.setPaperId(paperId);
        record.setRecordAnswer(answer);
        record.setRecordAcc(recordAcc);
        record.setRecordScore(recordScore);
        recordService.addRecord(record);
        return "redirect:/exam/toExam";
    }
    /**
     * 考试后台
     * */
    //查看所有考试安排后台
    @RequestMapping("/getAllExam")
    public String getAllExam(Model model){
        List<Exam> Exams = examService.getAllS();
        model.addAttribute("Exams",Exams);
        return "exam/backexamlist";
    }

    //去往考试添加页面
    @RequestMapping("/toAddExam")
    public String toAddExam(Model model){
        List<Paper> papers = paperService.getAll();
        model.addAttribute("papers",papers);
        return "exam/AddExam";
    }
    //添加操作
    @RequestMapping("/addExam")
    public String addExam(Exam exam, String examBegins,String examEnds) throws ParseException {
        String t1 = examBegins.replace("T", " ");
        String t2 = examEnds.replace("T", " ");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        Date begin = sdf.parse(t1);
        Date end = sdf.parse(t2);
        exam.setExamBegin(begin);
        exam.setExamEnd(end);
        examService.AddExam(exam);
        return "redirect:/exam/getAllExam";
    }
    @RequestMapping("/deleteExam/{id}")
    public String toEditExam(@PathVariable ("id") Integer id,Model model){
        examService.deleteById(id);
        return "redirect:/exam/getAllExam";
    }
}

 

java毕业设计之基于springboot题库管理系统源码含论文mysql404【包调试运行 指导】

 

  • 0
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿毕业分享网

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值