├── 前端 └── exam │ ├── static │ ├── .gitkeep │ └── img │ │ ├── book.jpg │ │ └── userimg.png │ ├── config │ ├── prod.env.js │ ├── dev.env.js │ └── index.js │ ├── build │ ├── logo.png │ ├── vue-loader.conf.js │ ├── build.js │ ├── check-versions.js │ ├── utils.js │ ├── webpack.base.conf.js │ └── webpack.dev.conf.js │ ├── src │ ├── assets │ │ ├── logo.png │ │ └── img │ │ │ ├── bad.jpg │ │ │ ├── bg.png │ │ │ ├── cry.jpg │ │ │ ├── log.jpg │ │ │ ├── cry1.gif │ │ │ ├── cry2.jpg │ │ │ ├── good1.jpg │ │ │ ├── good1.png │ │ │ ├── good2.gif │ │ │ ├── icon.png │ │ │ ├── tips.png │ │ │ ├── evening.png │ │ │ ├── loginbg.png │ │ │ └── userimg.png │ ├── components │ │ ├── common │ │ │ ├── mainTop.vue │ │ │ ├── navigator.vue │ │ │ ├── hello.vue │ │ │ └── mainLeft.vue │ │ ├── teacher │ │ │ ├── answerDescription.vue │ │ │ ├── examDescription.vue │ │ │ ├── addStudent.vue │ │ │ ├── allStudentsGrade.vue │ │ │ ├── addAnswer.vue │ │ │ ├── selectExamToPart.vue │ │ │ └── addExam.vue │ │ ├── student │ │ │ ├── myFooter.vue │ │ │ ├── scoreTable.vue │ │ │ └── manager.vue │ │ ├── admin │ │ │ ├── index.vue │ │ │ └── addTeacher.vue │ │ └── charts │ │ │ └── grade.vue │ ├── App.vue │ ├── vuex │ │ ├── Demo.vue │ │ └── store.js │ └── main.js │ ├── .editorconfig │ ├── .gitignore │ ├── .babelrc │ ├── .postcssrc.js │ ├── index.html │ ├── README.md │ └── package.json └── 后端 └── online-exam ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── src ├── main │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── onlineexam │ │ │ ├── pojo │ │ │ ├── Login.java │ │ │ ├── SubjectInfo.java │ │ │ ├── Answer.java │ │ │ ├── Item.java │ │ │ ├── PaperManage.java │ │ │ ├── Admin.java │ │ │ ├── Score.java │ │ │ ├── JudgeQuestion.java │ │ │ ├── FillQuestion.java │ │ │ ├── Replay.java │ │ │ ├── Teacher.java │ │ │ ├── Student.java │ │ │ ├── Message.java │ │ │ ├── MultiQuestion.java │ │ │ └── ExamManage.java │ │ │ ├── service │ │ │ ├── AdminService.java │ │ │ ├── PaperManageService.java │ │ │ ├── ReplayService.java │ │ │ ├── ScoreService.java │ │ │ ├── MessageService.java │ │ │ ├── FillQuestionService.java │ │ │ ├── JudgeQuestionService.java │ │ │ ├── AnswerService.java │ │ │ ├── TeacherService.java │ │ │ ├── StudentService.java │ │ │ ├── MultiQuestionService.java │ │ │ ├── ItemService.java │ │ │ ├── LoginService.java │ │ │ ├── ExamManageService.java │ │ │ └── impl │ │ │ │ ├── PaperManageServiceImpl.java │ │ │ │ ├── AdminServiceImpl.java │ │ │ │ ├── ReplayServiceImpl.java │ │ │ │ ├── ScoreServiceImpl.java │ │ │ │ ├── MessageServiceImpl.java │ │ │ │ ├── FillQuestionServiceImpl.java │ │ │ │ ├── LoginServiceImpl.java │ │ │ │ ├── JudgeQuestionServiceImpl.java │ │ │ │ ├── MultiQuestionServiceImpl.java │ │ │ │ ├── TeacherServiceImpl.java │ │ │ │ ├── StudentServiceImpl.java │ │ │ │ ├── ExamManageServiceImpl.java │ │ │ │ └── AnswerServiceImpl.java │ │ │ ├── mapper │ │ │ ├── AdminMapper.java │ │ │ ├── PaperManageMapper.java │ │ │ ├── ReplayMapper.java │ │ │ ├── AnswerMapper.java │ │ │ ├── ScoreMapper.java │ │ │ ├── MessageMapper.java │ │ │ ├── LoginMapper.java │ │ │ ├── TeacherMapper.java │ │ │ ├── StudentMapper.java │ │ │ ├── ItemMapper.java │ │ │ ├── JudgeQuestionMapper.java │ │ │ ├── FillQuestionMapper.java │ │ │ ├── ExamManageMapper.java │ │ │ └── MultiQuestionMapper.java │ │ │ ├── OnlineExamApplication.java │ │ │ ├── interceptor │ │ │ ├── MvcConfig.java │ │ │ └── LoginInterceptor.java │ │ │ ├── util │ │ │ ├── PageBean.java │ │ │ ├── ApiResultHandler.java │ │ │ ├── ApiResult.java │ │ │ └── MD5EncodingUtil.java │ │ │ └── controller │ │ │ ├── AdminController.java │ │ │ ├── ReplayController.java │ │ │ ├── ItemController.java │ │ │ ├── FillQuestionController.java │ │ │ ├── JudgeQuestionController.java │ │ │ ├── MultiQuestionController.java │ │ │ ├── MessageController.java │ │ │ ├── ScoreController.java │ │ │ ├── PaperManageController.java │ │ │ ├── LoginController.java │ │ │ ├── StudentController.java │ │ │ ├── AnswerController.java │ │ │ ├── TeacherController.java │ │ │ └── ExamManageController.java │ └── resources │ │ └── application.properties └── test │ └── java │ └── com │ └── example │ └── onlineexam │ └── OnlineExamApplicationTests.java ├── .idea ├── encodings.xml ├── modules.xml ├── inspectionProfiles │ └── Project_Default.xml ├── misc.xml ├── libraries │ ├── Maven__junit_junit_4_12.xml │ ├── Maven__org_ow2_asm_asm_5_0_3.xml │ ├── Maven__org_yaml_snakeyaml_1_17.xml │ ├── Maven__org_mybatis_mybatis_3_5_1.xml │ ├── Maven__org_objenesis_objenesis_2_1.xml │ ├── Maven__org_slf4j_slf4j_api_1_7_25.xml │ ├── Maven__com_fasterxml_classmate_1_3_4.xml │ ├── Maven__net_minidev_json_smart_2_2_1.xml │ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml │ ├── Maven__org_assertj_assertj_core_2_6_0.xml │ ├── Maven__org_projectlombok_lombok_1_16_22.xml │ ├── Maven__org_slf4j_jul_to_slf4j_1_7_25.xml │ ├── Maven__org_skyscreamer_jsonassert_1_4_0.xml │ ├── Maven__net_minidev_accessors_smart_1_1.xml │ ├── Maven__com_jayway_jsonpath_json_path_2_2_0.xml │ ├── Maven__org_mockito_mockito_core_1_10_19.xml │ ├── Maven__org_mybatis_mybatis_spring_2_0_1.xml │ ├── Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml │ ├── Maven__com_github_jsqlparser_jsqlparser_1_0.xml │ ├── Maven__org_hamcrest_hamcrest_library_1_3.xml │ ├── Maven__ch_qos_logback_logback_core_1_1_11.xml │ ├── Maven__org_apache_tomcat_tomcat_jdbc_8_5_37.xml │ ├── Maven__org_apache_tomcat_tomcat_juli_8_5_37.xml │ ├── Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml │ ├── Maven__com_github_pagehelper_pagehelper_5_1_4.xml │ ├── Maven__mysql_mysql_connector_java_5_1_47.xml │ ├── Maven__ch_qos_logback_logback_classic_1_1_11.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_8_11.xml │ ├── Maven__org_jboss_logging_jboss_logging_3_3_2_Final.xml │ ├── Maven__javax_validation_validation_api_1_1_0_Final.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_37.xml │ ├── Maven__org_springframework_spring_tx_4_3_22_RELEASE.xml │ ├── Maven__org_springframework_spring_aop_4_3_22_RELEASE.xml │ ├── Maven__org_springframework_spring_web_4_3_22_RELEASE.xml │ ├── Maven__org_springframework_spring_core_4_3_22_RELEASE.xml │ ├── Maven__org_springframework_spring_jdbc_4_3_22_RELEASE.xml │ ├── Maven__org_springframework_spring_test_4_3_22_RELEASE.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_37.xml │ ├── Maven__org_springframework_spring_beans_4_3_22_RELEASE.xml │ ├── Maven__org_hibernate_hibernate_validator_5_3_6_Final.xml │ ├── Maven__org_apache_tomcat_tomcat_annotations_api_8_5_37.xml │ ├── Maven__org_springframework_spring_webmvc_4_3_22_RELEASE.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_0.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_8_11_3.xml │ ├── Maven__org_springframework_boot_spring_boot_1_5_19_RELEASE.xml │ ├── Maven__org_springframework_spring_context_4_3_22_RELEASE.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_37.xml │ ├── Maven__org_springframework_spring_expression_4_3_22_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_test_1_5_19_RELEASE.xml │ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_0_1.xml │ ├── Maven__com_github_pagehelper_pagehelper_spring_boot_starter_1_2_5.xml │ ├── Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_1_5_19_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_web_1_5_19_RELEASE.xml │ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_0_1.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_jdbc_1_5_19_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_test_1_5_19_RELEASE.xml │ ├── Maven__com_github_pagehelper_pagehelper_spring_boot_autoconfigure_1_2_5.xml │ ├── Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_19_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_tomcat_1_5_19_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_logging_1_5_19_RELEASE.xml │ └── Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_19_RELEASE.xml └── compiler.xml └── pom.xml /前端/exam/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /前端/exam/config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /前端/exam/build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/build/logo.png -------------------------------------------------------------------------------- /前端/exam/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/logo.png -------------------------------------------------------------------------------- /前端/exam/static/img/book.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/static/img/book.jpg -------------------------------------------------------------------------------- /前端/exam/src/assets/img/bad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/bad.jpg -------------------------------------------------------------------------------- /前端/exam/src/assets/img/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/bg.png -------------------------------------------------------------------------------- /前端/exam/src/assets/img/cry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/cry.jpg -------------------------------------------------------------------------------- /前端/exam/src/assets/img/log.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/log.jpg -------------------------------------------------------------------------------- /前端/exam/static/img/userimg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/static/img/userimg.png -------------------------------------------------------------------------------- /前端/exam/src/assets/img/cry1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/cry1.gif -------------------------------------------------------------------------------- /前端/exam/src/assets/img/cry2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/cry2.jpg -------------------------------------------------------------------------------- /前端/exam/src/assets/img/good1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/good1.jpg -------------------------------------------------------------------------------- /前端/exam/src/assets/img/good1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/good1.png -------------------------------------------------------------------------------- /前端/exam/src/assets/img/good2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/good2.gif -------------------------------------------------------------------------------- /前端/exam/src/assets/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/icon.png -------------------------------------------------------------------------------- /前端/exam/src/assets/img/tips.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/tips.png -------------------------------------------------------------------------------- /前端/exam/src/assets/img/evening.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/evening.png -------------------------------------------------------------------------------- /前端/exam/src/assets/img/loginbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/loginbg.png -------------------------------------------------------------------------------- /前端/exam/src/assets/img/userimg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/前端/exam/src/assets/img/userimg.png -------------------------------------------------------------------------------- /前端/exam/src/components/common/mainTop.vue: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /后端/online-exam/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cartoonssss/SpringBoot-Vue/HEAD/后端/online-exam/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /后端/online-exam/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /前端/exam/config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /前端/exam/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /前端/exam/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | .vscode 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/Login.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Login { 7 | private Integer username; 8 | private String password; 9 | } 10 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/AdminService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | 4 | 5 | import com.example.onlineexam.pojo.Admin; 6 | 7 | 8 | public interface AdminService { 9 | 10 | int updatePwd(Admin admin); 11 | } 12 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/PaperManageService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.PaperManage; 4 | 5 | public interface PaperManageService { 6 | int addPaper(PaperManage paperManage); 7 | } 8 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.username=root 2 | spring.datasource.password=root 3 | spring.datasource.url=jdbc:mysql://localhost:3306/exam 4 | mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl 5 | server.port=8081 6 | 7 | 8 | -------------------------------------------------------------------------------- /前端/exam/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"] 12 | } 13 | -------------------------------------------------------------------------------- /前端/exam/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/ReplayService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.Replay; 4 | 5 | import java.util.List; 6 | 7 | public interface ReplayService { 8 | int addReplay(Replay replay); 9 | 10 | List selectById(Integer messageId); 11 | } 12 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/SubjectInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class SubjectInfo { 7 | private Integer subjectId; 8 | 9 | private String subjectName; 10 | 11 | private String institute; 12 | 13 | private Integer instituteId; 14 | 15 | private Integer teacherId; 16 | } -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/Answer.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Answer { 7 | private Integer questionId; 8 | private String question; 9 | private String subject; 10 | private String score; 11 | private String section; 12 | private String level; 13 | private String type; 14 | } 15 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/ScoreService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.Score; 4 | 5 | import java.util.List; 6 | 7 | public interface ScoreService { 8 | List getScoreByStudentId(int studentId); 9 | 10 | List getScoreByExamCode(int examCode); 11 | 12 | int addScore(Score score); 13 | } 14 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/Item.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | //题目模型 6 | @Data 7 | public class Item { 8 | private Integer level; 9 | 10 | private String subject; 11 | 12 | private Integer paperId; 13 | 14 | private Integer changeNumber; 15 | 16 | private Integer fillNumber; 17 | 18 | private Integer judgeNumber; 19 | } 20 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/MessageService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.Message; 4 | import com.example.onlineexam.util.PageBean; 5 | 6 | public interface MessageService { 7 | int addMessage(Message message); 8 | 9 | PageBean MessageByPage(Integer page, Integer size); 10 | 11 | Message selectById(Integer id); 12 | } 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/PaperManage.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class PaperManage { 11 | private Integer paperId; 12 | 13 | private Integer questionType; 14 | 15 | private Integer questionId; 16 | 17 | 18 | } -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/Admin.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Admin { 7 | private Integer adminId; 8 | 9 | private String adminName; 10 | 11 | private String sex; 12 | 13 | private String tel; 14 | 15 | private String email; 16 | 17 | private String pwd; 18 | 19 | private String cardId; 20 | 21 | private String role; 22 | } -------------------------------------------------------------------------------- /前端/exam/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 在线考试系统 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/Score.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Score { 7 | private Integer examCode; 8 | 9 | private Integer studentId; 10 | 11 | private String subject; 12 | 13 | private Integer ptScore; 14 | 15 | private Integer etScore; 16 | 17 | private Integer score; 18 | 19 | private Integer scoreId; 20 | 21 | private String answerDate; 22 | } -------------------------------------------------------------------------------- /前端/exam/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 29 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/FillQuestionService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.FillQuestion; 4 | 5 | import java.util.List; 6 | 7 | public interface FillQuestionService { 8 | int addFillQuestion(FillQuestion fillQuestion); 9 | 10 | FillQuestion fillQuestionId(); 11 | 12 | List getFillQuestionByPaperId(int paperId); 13 | 14 | int updateQuestion(FillQuestion fillQuestion); 15 | } 16 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/JudgeQuestion.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | //判断题实体类 6 | @Data 7 | public class JudgeQuestion { 8 | private Integer questionId; 9 | 10 | private String subject; 11 | 12 | private String question; 13 | 14 | private String answer; 15 | 16 | private String level; 17 | 18 | private String section; 19 | 20 | private Integer score; 21 | 22 | private String analysis; //题目解析 23 | } -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/JudgeQuestionService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.JudgeQuestion; 4 | 5 | import java.util.List; 6 | 7 | public interface JudgeQuestionService { 8 | int addJudgeQuestion(JudgeQuestion judgeQuestion); 9 | 10 | JudgeQuestion judgeQuestionId(); 11 | 12 | List getJudgeQuestionByPaperId(int paperId); 13 | 14 | int updateQuestion(JudgeQuestion judgeQuestion); 15 | } 16 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/AdminMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | 4 | import com.example.onlineexam.pojo.Admin; 5 | import org.apache.ibatis.annotations.*; 6 | 7 | import java.util.List; 8 | 9 | @Mapper 10 | public interface AdminMapper { 11 | 12 | /** 13 | * 更新密码 14 | * @param admin 15 | * @return 受影响的记录条数 16 | */ 17 | @Update("update admin set pwd = #{pwd} where adminId = #{adminId}") 18 | int updatePwd(Admin admin); 19 | } 20 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/FillQuestion.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | //填空题实体类 6 | @Data 7 | public class FillQuestion { 8 | private Integer questionId; 9 | 10 | private String subject; 11 | 12 | private String question; 13 | 14 | private String answer; 15 | 16 | private Integer score; 17 | 18 | private String level; 19 | 20 | private String section; 21 | 22 | private String analysis; //题目解析 23 | } 24 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/Replay.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | 8 | @Data 9 | public class Replay { 10 | private Integer messageId; 11 | 12 | private Integer replayId; 13 | 14 | private String replay; 15 | 16 | private String replayName; 17 | 18 | @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8") 19 | private Date replayTime; 20 | } -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/AnswerService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.Answer; 4 | import com.example.onlineexam.util.ApiResult; 5 | import com.example.onlineexam.util.PageBean; 6 | 7 | public interface AnswerService { 8 | PageBean selectAnswerByPage(Integer page, Integer size); 9 | 10 | ApiResult selectQuestion(Integer questionId, String type); 11 | 12 | ApiResult deleteQuestion(Integer questionId, String type); 13 | } 14 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__junit_junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/PaperManageMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.PaperManage; 4 | import org.apache.ibatis.annotations.Insert; 5 | import org.apache.ibatis.annotations.Select; 6 | 7 | public interface PaperManageMapper { 8 | @Insert("insert into " + 9 | "papermanage(paperId,questionType,questionId) values " + 10 | "(#{paperId},#{questionType},#{questionId})") 11 | int addPaper(PaperManage paperManage); 12 | } 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/Teacher.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Teacher { 7 | private Integer teacherId; 8 | 9 | private String teacherName; 10 | 11 | private String institute; 12 | 13 | private String sex; 14 | 15 | private String tel; 16 | 17 | private String email; 18 | 19 | private String pwd; 20 | 21 | private String cardId; 22 | 23 | private String type; 24 | 25 | private String role; 26 | } -------------------------------------------------------------------------------- /前端/exam/README.md: -------------------------------------------------------------------------------- 1 | # vue-init 2 | 3 | > vue demo 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # build for production and view the bundle analyzer report 18 | npm run build --report 19 | ``` 20 | 21 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 22 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_ow2_asm_asm_5_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_yaml_snakeyaml_1_17.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_mybatis_mybatis_3_5_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/TeacherService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.Teacher; 4 | import com.example.onlineexam.util.PageBean; 5 | 6 | public interface TeacherService { 7 | PageBean selectTeacherByPage(Integer page, Integer size); 8 | 9 | Integer addTeacher(Teacher teacher); 10 | 11 | Teacher selectTeacherById(Integer id); 12 | 13 | Integer updateTeacher(Teacher teacher); 14 | 15 | Integer deleteTeacher(Integer id); 16 | 17 | int updatePwdTeacher(Teacher teacher); 18 | } 19 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_objenesis_objenesis_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/StudentService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.Student; 4 | import com.example.onlineexam.util.PageBean; 5 | 6 | public interface StudentService { 7 | PageBean selectStudentByPage(Integer page, Integer size); 8 | 9 | Student selectStudentById(Integer id); 10 | 11 | Integer updateStudent(Student student); 12 | 13 | Integer addStudent(Student student); 14 | 15 | Integer deleteStudent(Integer id); 16 | 17 | Integer updateStudentPwd(Student student); 18 | } 19 | -------------------------------------------------------------------------------- /前端/exam/src/vuex/Demo.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 27 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/Student.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Student { 7 | private Integer studentId; 8 | 9 | private String studentName; 10 | 11 | private String grade; 12 | 13 | private String major; 14 | 15 | private String clazz; 16 | 17 | private String institute; 18 | 19 | private String tel; 20 | 21 | private String email; 22 | 23 | private String pwd; 24 | 25 | private String cardId; 26 | 27 | private String sex; 28 | 29 | private String role; 30 | } -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__com_fasterxml_classmate_1_3_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__net_minidev_json_smart_2_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/MultiQuestionService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.MultiQuestion; 4 | 5 | import java.util.List; 6 | 7 | public interface MultiQuestionService { 8 | int addMultiQuestion(MultiQuestion multiQuestion); 9 | 10 | MultiQuestion multiQuestionId(); 11 | 12 | List getmultiQuestionByPaperId(int paperId); 13 | 14 | MultiQuestion selectById(Integer questionId); 15 | 16 | int updateQuestion(MultiQuestion multiQuestion); 17 | 18 | int deleteById(Integer questionId); 19 | } 20 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/Message.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | import java.util.List; 8 | 9 | @Data 10 | public class Message { 11 | private Integer id; 12 | private Integer temp_id;//解决id为null创建的一个临时id 13 | 14 | private String title; 15 | 16 | private String content; 17 | 18 | private String name; 19 | 20 | @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8") 21 | private Date time; 22 | 23 | List replays; //一对多关系,评论信息 24 | } -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_assertj_assertj_core_2_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_projectlombok_lombok_1_16_22.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/ItemService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.Item; 4 | import com.example.onlineexam.util.ApiResult; 5 | 6 | import java.util.List; 7 | 8 | public interface ItemService { 9 | // List randMultiQuestion(String subject, Integer changeNumber); 10 | // 11 | // List randFillQuestion(String subject, Integer fillNumber); 12 | // 13 | // List randJudgeQuestion(String subject, Integer judgeNumber); 14 | 15 | ApiResult randItem(Item item); 16 | 17 | int cleanPaper(Integer paperId); 18 | } 19 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__net_minidev_accessors_smart_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_mockito_mockito_core_1_10_19.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_mybatis_mybatis_spring_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__com_github_jsqlparser_jsqlparser_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_apache_tomcat_tomcat_jdbc_8_5_37.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_apache_tomcat_tomcat_juli_8_5_37.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__com_github_pagehelper_pagehelper_5_1_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /前端/exam/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_47.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/OnlineExamApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.web.client.RestTemplate; 8 | 9 | @SpringBootApplication 10 | @MapperScan(basePackages = "com.example.onlineexam.mapper") 11 | public class OnlineExamApplication { 12 | public static void main(String[] args) { 13 | SpringApplication.run(OnlineExamApplication.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/MultiQuestion.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | // 选择题实体 6 | @Data 7 | public class MultiQuestion { 8 | private Integer questionId; 9 | 10 | private String subject; 11 | 12 | private String section; 13 | 14 | private String answerA; 15 | 16 | private String answerB; 17 | 18 | private String answerC; 19 | 20 | private String answerD; 21 | 22 | private String question; 23 | 24 | private String level; 25 | 26 | private String rightAnswer; 27 | 28 | private String analysis; //题目解析 29 | 30 | private Integer score; 31 | 32 | } -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/LoginService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.Admin; 4 | import com.example.onlineexam.pojo.Student; 5 | import com.example.onlineexam.pojo.Teacher; 6 | import com.example.onlineexam.util.ApiResult; 7 | import com.example.onlineexam.pojo.Login; 8 | 9 | public interface LoginService { 10 | /*ApiResult login(Login login);*/ 11 | 12 | public Admin adminLogin(Integer username, String password); 13 | 14 | public Teacher teacherLogin(Integer username, String password); 15 | 16 | public Student studentLogin(Integer username, String password); 17 | } 18 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/pojo/ExamManage.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.pojo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class ExamManage { 7 | private Integer examCode; 8 | 9 | private String description; 10 | 11 | private String source; 12 | 13 | private Integer paperId; 14 | 15 | private String examDate; 16 | 17 | private Integer totalTime; 18 | 19 | private String grade; 20 | 21 | private String term; 22 | 23 | private String major; 24 | 25 | private String institute; 26 | 27 | private Integer totalScore; 28 | 29 | private String type; 30 | 31 | private String tips; 32 | } -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/ReplayMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.Replay; 4 | import org.apache.ibatis.annotations.Insert; 5 | import org.apache.ibatis.annotations.Select; 6 | 7 | import java.util.List; 8 | 9 | public interface ReplayMapper { 10 | @Insert("insert into " + 11 | "replay(messageId,replay,replayTime,replayName) " + 12 | "values(#{messageId}, #{replay},#{replayTime},#{replayName})") 13 | int addReplay(Replay replay); 14 | 15 | @Select("select * from replay where messageId = #{messageId}") 16 | List selectById(Integer messageId); 17 | } 18 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/AnswerMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.Answer; 4 | import org.apache.ibatis.annotations.Select; 5 | 6 | import java.util.List; 7 | 8 | public interface AnswerMapper { 9 | 10 | @Select("select questionId,question, subject, score, section,level, \"选择题\" as type from multiquestion " + 11 | "union select questionId,question, subject, score, section,level, \"判断题\" as type from judgequestion " + 12 | "union select questionId,question, subject, score, section,level, \"填空题\" as type from fillquestion") 13 | List selectAllAnswer(); 14 | } 15 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_8_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_2_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__javax_validation_validation_api_1_1_0_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_37.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_spring_tx_4_3_22_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_spring_aop_4_3_22_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_spring_web_4_3_22_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_spring_core_4_3_22_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_spring_jdbc_4_3_22_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_spring_test_4_3_22_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_37.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_spring_beans_4_3_22_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_hibernate_hibernate_validator_5_3_6_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_apache_tomcat_tomcat_annotations_api_8_5_37.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_spring_webmvc_4_3_22_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_8_11_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_boot_spring_boot_1_5_19_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_spring_context_4_3_22_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /前端/exam/src/components/teacher/answerDescription.vue: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 31 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_37.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_spring_expression_4_3_22_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/interceptor/MvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.interceptor; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 7 | 8 | /** 9 | * 拦截器配置 10 | */ 11 | @Configuration 12 | public class MvcConfig extends WebMvcConfigurerAdapter { 13 | 14 | @Override 15 | public void addInterceptors(InterceptorRegistry registry) { 16 | 17 | registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").excludePathPatterns("/","/login"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /前端/exam/src/components/teacher/examDescription.vue: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 30 | -------------------------------------------------------------------------------- /前端/exam/src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | import echarts from 'echarts' 7 | import axios from 'axios' 8 | import ElementUI from 'element-ui' 9 | import 'element-ui/lib/theme-chalk/index.css' 10 | import VueCookies from 'vue-cookies' 11 | 12 | Vue.use(ElementUI) 13 | Vue.use(VueCookies) 14 | 15 | Vue.config.productionTip = false 16 | Vue.prototype.bus = new Vue() 17 | Vue.prototype.$echarts = echarts 18 | Vue.prototype.$axios = axios 19 | 20 | new Vue({ 21 | el: '#app', 22 | router, 23 | render: h => h(App), 24 | components: { App }, 25 | template: '' 26 | }) 27 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/util/PageBean.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.util; 2 | import com.github.pagehelper.PageInfo; 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | @Data 7 | public class PageBean { 8 | private List records; //结果集 9 | private long total; //总记录数 10 | private int size; //每页条数 11 | private int current; //当前页 12 | private int pages; //总页数 13 | 14 | public PageBean(List list,int size) { 15 | PageInfo pageInfo = new PageInfo<>(list); 16 | this.records=pageInfo.getList(); 17 | this.total=pageInfo.getTotal(); 18 | this.size=size; 19 | this.current=pageInfo.getPageNum(); 20 | this.pages=pageInfo.getPages(); 21 | } 22 | } -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_1_5_19_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__com_github_pagehelper_pagehelper_spring_boot_starter_1_2_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_5_19_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/ExamManageService.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service; 2 | 3 | import com.example.onlineexam.pojo.ExamManage; 4 | import com.example.onlineexam.util.PageBean; 5 | 6 | import java.util.List; 7 | 8 | public interface ExamManageService { 9 | PageBean selectExamManageByPage(Integer page, Integer size); 10 | 11 | PageBean selectPartExamManageByPage(Integer page, Integer size); 12 | 13 | List selectPartExamManage(); 14 | 15 | Integer examManagePaperId(); 16 | 17 | Integer addExam(ExamManage examManage); 18 | 19 | ExamManage selectExamManageById(Integer id); 20 | 21 | Integer updateExam(ExamManage examManage); 22 | 23 | Integer deleteExam(Integer id); 24 | 25 | List selectAll(); 26 | } 27 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/util/ApiResultHandler.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.util; 2 | 3 | 4 | public class ApiResultHandler { 5 | 6 | public static ApiResult success(Object object) { 7 | ApiResult apiResult = new ApiResult(); 8 | apiResult.setData(object); 9 | apiResult.setCode(200); 10 | apiResult.setMessage("请求成功"); 11 | return apiResult; 12 | } 13 | 14 | public static ApiResult success() { 15 | return success(null); 16 | } 17 | 18 | public static ApiResult buildApiResult(Integer code, String message, T data) { 19 | ApiResult apiResult = new ApiResult(); 20 | apiResult.setCode(code); 21 | apiResult.setMessage(message); 22 | apiResult.setData(data); 23 | return apiResult; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/PaperManageServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.PaperManageMapper; 4 | import com.example.onlineexam.pojo.PaperManage; 5 | import com.example.onlineexam.service.PaperManageService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.transaction.annotation.Transactional; 9 | 10 | @Service 11 | public class PaperManageServiceImpl implements PaperManageService { 12 | @Autowired 13 | private PaperManageMapper paperManageMapper; 14 | 15 | @Override 16 | @Transactional 17 | public int addPaper(PaperManage paperManage) { 18 | return paperManageMapper.addPaper(paperManage); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_1_5_19_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/AdminServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | 4 | import com.example.onlineexam.mapper.AdminMapper; 5 | import com.example.onlineexam.pojo.Admin; 6 | import com.example.onlineexam.service.AdminService; 7 | import com.example.onlineexam.util.MD5EncodingUtil; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | 13 | @Service 14 | public class AdminServiceImpl implements AdminService { 15 | 16 | @Autowired 17 | private AdminMapper adminMapper; 18 | 19 | 20 | 21 | @Override 22 | public int updatePwd(Admin admin) { 23 | admin.setPwd(MD5EncodingUtil.getMD5(admin.getPwd())); 24 | return adminMapper.updatePwd(admin); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_1_5_19_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_1_5_19_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__com_github_pagehelper_pagehelper_spring_boot_autoconfigure_1_2_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_19_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /前端/exam/src/components/student/myFooter.vue: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 17 | 18 | 40 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/ReplayServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.ReplayMapper; 4 | import com.example.onlineexam.pojo.Replay; 5 | import com.example.onlineexam.service.ReplayService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | @Service 12 | public class ReplayServiceImpl implements ReplayService { 13 | @Autowired 14 | private ReplayMapper replayMapper; 15 | 16 | @Override 17 | public int addReplay(Replay replay) { 18 | return replayMapper.addReplay(replay); 19 | } 20 | 21 | @Override 22 | public List selectById(Integer messageId) { 23 | return replayMapper.selectById(messageId); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_1_5_19_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/ScoreMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.Score; 4 | import org.apache.ibatis.annotations.Insert; 5 | import org.apache.ibatis.annotations.Select; 6 | 7 | import java.util.List; 8 | 9 | public interface ScoreMapper { 10 | @Select("select * from score where studentId=#{studentId} ORDER BY answerDate") 11 | List selectScoreByStudentId(int studentId); 12 | 13 | @Select("select * from score where examCode=#{examCode}") 14 | List getScoreByExamCode(int examCode); 15 | 16 | @Insert("insert into " + 17 | "score(examCode,studentId,subject,ptScore,etScore,score,answerDate) " + 18 | "values(#{examCode},#{studentId},#{subject},#{ptScore},#{etScore},#{score},#{answerDate})") 19 | int addScore(Score score); 20 | } 21 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_5_19_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_19_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/MessageMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.Message; 4 | import org.apache.ibatis.annotations.*; 5 | 6 | import java.util.List; 7 | 8 | public interface MessageMapper { 9 | @Insert("insert into " + 10 | "message(title, content, time,name) " + 11 | "values(#{title},#{content},#{time},#{name})") 12 | int addMessage(Message message); 13 | 14 | @Select("select id,id as temp_id,title,content,time,name from message order by id desc") 15 | @Results({ 16 | @Result(property = "replays", column = "temp_id",many = @Many(select = "com.example.onlineexam.mapper.ReplayMapper.selectById")) 17 | }) 18 | List selectAllMessage(); 19 | 20 | @Select("select * from message where id = #{id}") 21 | Message selectById(Integer id); 22 | } 23 | -------------------------------------------------------------------------------- /后端/online-exam/src/test/java/com/example/onlineexam/OnlineExamApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam; 2 | 3 | import com.example.onlineexam.mapper.ExamManageMapper; 4 | import com.example.onlineexam.pojo.ExamManage; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.test.context.junit4.SpringRunner; 10 | 11 | import java.util.List; 12 | 13 | @RunWith(SpringRunner.class) 14 | @SpringBootTest 15 | public class OnlineExamApplicationTests { 16 | @Autowired 17 | private ExamManageMapper examManageMapper; 18 | 19 | @Test 20 | public void contextLoads() { 21 | } 22 | 23 | @Test 24 | public void testExamManageMapper() { 25 | List examManages = examManageMapper.selectAllExamManage(); 26 | System.out.println("examManages = " + examManages); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/AdminController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | 4 | import com.example.onlineexam.pojo.Admin; 5 | import com.example.onlineexam.service.impl.AdminServiceImpl; 6 | import com.example.onlineexam.util.ApiResult; 7 | import com.example.onlineexam.util.ApiResultHandler; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.PutMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | @RestController 14 | public class AdminController { 15 | 16 | @Autowired 17 | private AdminServiceImpl adminService; 18 | 19 | @PutMapping("/adminPWD") 20 | public ApiResult updatePwd(@RequestBody Admin admin) { 21 | System.out.println("admin..."); 22 | adminService.updatePwd(admin); 23 | return ApiResultHandler.buildApiResult(200,"密码更新成功",null); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/ScoreServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.ScoreMapper; 4 | import com.example.onlineexam.pojo.Score; 5 | import com.example.onlineexam.service.ScoreService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | @Service 12 | public class ScoreServiceImpl implements ScoreService { 13 | @Autowired 14 | private ScoreMapper scoreMapper; 15 | 16 | @Override 17 | public List getScoreByStudentId(int studentId) { 18 | return scoreMapper.selectScoreByStudentId(studentId); 19 | } 20 | 21 | @Override 22 | public List getScoreByExamCode(int examCode) { 23 | return scoreMapper.getScoreByExamCode(examCode); 24 | } 25 | 26 | @Override 27 | public int addScore(Score score) { 28 | return scoreMapper.addScore(score); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/util/ApiResult.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.util; 2 | 3 | 4 | public class ApiResult { 5 | /** 6 | * 错误码,表示一种错误类型 7 | * 请求成功,状态码为200 8 | */ 9 | private int code; 10 | 11 | /** 12 | * 对错误代码的详细解释 13 | */ 14 | private String message; 15 | 16 | /** 17 | * 返回的结果包装在value中,value可以是单个对象 18 | */ 19 | private T data; 20 | 21 | public ApiResult() { 22 | } 23 | 24 | public ApiResult(int code, String message, T data) { 25 | this.code = code; 26 | this.message = message; 27 | this.data = data; 28 | } 29 | 30 | public int getCode() { 31 | return code; 32 | } 33 | 34 | public void setCode(int code) { 35 | this.code = code; 36 | } 37 | 38 | public String getMessage() { 39 | return message; 40 | } 41 | 42 | public void setMessage(String message) { 43 | this.message = message; 44 | } 45 | 46 | public T getData() { 47 | return data; 48 | } 49 | 50 | public void setData(T data) { 51 | this.data = data; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /前端/exam/src/components/admin/index.vue: -------------------------------------------------------------------------------- 1 | // 展示组件页面 2 | 16 | 17 | 37 | 38 | 53 | 54 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/LoginMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.Admin; 4 | import com.example.onlineexam.pojo.Login; 5 | import com.example.onlineexam.pojo.Student; 6 | import com.example.onlineexam.pojo.Teacher; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.apache.ibatis.annotations.Select; 9 | 10 | public interface LoginMapper { 11 | 12 | 13 | @Select("select adminId,adminName,sex,tel,email,cardId,role from admin where adminId = #{username} and pwd = #{password}") 14 | public Admin adminLogin(@Param("username") Integer username, @Param("password") String password); 15 | 16 | @Select("select teacherId,teacherName,institute,sex,tel,email,cardId," + 17 | "type,role from teacher where teacherId = #{username} and pwd = #{password}") 18 | public Teacher teacherLogin(@Param("username") Integer username,@Param("password") String password); 19 | 20 | @Select("select studentId,studentName,grade,major,clazz,institute,tel," + 21 | "email,cardId,sex,role from student where studentId = #{username} and pwd = #{password}") 22 | public Student studentLogin(@Param("username") Integer username,@Param("password") String password); 23 | } 24 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/ReplayController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.pojo.Replay; 4 | import com.example.onlineexam.service.ReplayService; 5 | import com.example.onlineexam.util.ApiResult; 6 | import com.example.onlineexam.util.ApiResultHandler; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import java.util.List; 11 | 12 | @RestController 13 | public class ReplayController { 14 | @Autowired 15 | private ReplayService replayService; 16 | 17 | @PostMapping("replay") 18 | public ApiResult replay(@RequestBody Replay replay){ 19 | int i = replayService.addReplay(replay); 20 | if(i==1){ 21 | return ApiResultHandler.buildApiResult(200, "回复留言成功", i); 22 | } 23 | else { 24 | return ApiResultHandler.buildApiResult(400, "回复留言失败", i); 25 | } 26 | } 27 | @GetMapping("replay/{messageId}") 28 | public ApiResult selectById(@PathVariable("messageId") Integer messageId){ 29 | List replays = replayService.selectById(messageId); 30 | return ApiResultHandler.buildApiResult(200, "查找留言", replays); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/MessageServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.MessageMapper; 4 | import com.example.onlineexam.pojo.Message; 5 | import com.example.onlineexam.service.MessageService; 6 | import com.example.onlineexam.util.PageBean; 7 | import com.github.pagehelper.PageHelper; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | 13 | @Service 14 | public class MessageServiceImpl implements MessageService { 15 | @Autowired 16 | private MessageMapper messageMapper; 17 | 18 | @Override 19 | public int addMessage(Message message) { 20 | return messageMapper.addMessage(message); 21 | } 22 | 23 | @Override 24 | public PageBean MessageByPage(Integer page, Integer size) { 25 | PageHelper.startPage(page, size); 26 | List messages = messageMapper.selectAllMessage(); 27 | PageBean messagePageBean = new PageBean<>(messages,size); 28 | return messagePageBean; 29 | } 30 | 31 | @Override 32 | public Message selectById(Integer id) { 33 | return messageMapper.selectById(id); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/util/MD5EncodingUtil.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.util; 2 | 3 | import java.security.MessageDigest; 4 | 5 | public class MD5EncodingUtil { 6 | 7 | public static String getMD5(String key){ 8 | char hexDigits[] = { 9 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' 10 | }; 11 | try { 12 | byte[] btInput = key.getBytes(); 13 | // 获得MD5摘要算法的 MessageDigest 对象 14 | MessageDigest mdInst = MessageDigest.getInstance("MD5"); 15 | // 使用指定的字节更新摘要 16 | mdInst.update(btInput); 17 | // 获得密文 18 | byte[] md = mdInst.digest(); 19 | // 把密文转换成十六进制的字符串形式 20 | int j = md.length; 21 | char str[] = new char[j * 2]; 22 | int k = 0; 23 | for (int i = 0; i < j; i++) { 24 | byte byte0 = md[i]; 25 | str[k++] = hexDigits[byte0 >>> 4 & 0xf]; 26 | str[k++] = hexDigits[byte0 & 0xf]; 27 | } 28 | return new String(str); 29 | } catch (Exception e) { 30 | return null; 31 | } 32 | } 33 | 34 | public static void main(String[] args) { 35 | System.out.println(getMD5("1")); 36 | 37 | } 38 | } -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/FillQuestionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.FillQuestionMapper; 4 | import com.example.onlineexam.pojo.FillQuestion; 5 | import com.example.onlineexam.service.FillQuestionService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.transaction.annotation.Transactional; 9 | 10 | import java.util.List; 11 | 12 | @Service 13 | public class FillQuestionServiceImpl implements FillQuestionService { 14 | @Autowired 15 | private FillQuestionMapper fillQuestionMapper; 16 | 17 | @Override 18 | @Transactional 19 | public int addFillQuestion(FillQuestion fillQuestion) { 20 | return fillQuestionMapper.addFillQuestion(fillQuestion); 21 | } 22 | 23 | @Override 24 | public FillQuestion fillQuestionId() { 25 | return fillQuestionMapper.fillQuestionId(); 26 | } 27 | 28 | @Override 29 | public List getFillQuestionByPaperId(int paperId) { 30 | return fillQuestionMapper.getFillQuestionByPaperId(paperId); 31 | } 32 | 33 | @Override 34 | public int updateQuestion(FillQuestion fillQuestion) { 35 | return fillQuestionMapper.updateQuestion(fillQuestion); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /前端/exam/build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/LoginServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.LoginMapper; 4 | import com.example.onlineexam.pojo.*; 5 | import com.example.onlineexam.service.LoginService; 6 | import com.example.onlineexam.util.ApiResult; 7 | import com.example.onlineexam.util.ApiResultHandler; 8 | import com.example.onlineexam.util.MD5EncodingUtil; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | @Service 13 | public class LoginServiceImpl implements LoginService { 14 | @Autowired 15 | private LoginMapper loginMapper; 16 | 17 | 18 | @Override 19 | public Admin adminLogin(Integer username, String password) { 20 | password= MD5EncodingUtil.getMD5(password); 21 | return loginMapper.adminLogin(username,password); 22 | } 23 | 24 | @Override 25 | public Teacher teacherLogin(Integer username, String password) { 26 | password= MD5EncodingUtil.getMD5(password); 27 | return loginMapper.teacherLogin(username,password); 28 | } 29 | 30 | @Override 31 | public Student studentLogin(Integer username, String password) { 32 | password= MD5EncodingUtil.getMD5(password); 33 | return loginMapper.studentLogin(username,password); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/JudgeQuestionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.JudgeQuestionMapper; 4 | import com.example.onlineexam.pojo.JudgeQuestion; 5 | import com.example.onlineexam.service.JudgeQuestionService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.transaction.annotation.Transactional; 9 | 10 | import java.util.List; 11 | 12 | @Service 13 | public class JudgeQuestionServiceImpl implements JudgeQuestionService { 14 | @Autowired 15 | private JudgeQuestionMapper judgeQuestionMapper; 16 | 17 | @Override 18 | @Transactional 19 | public int addJudgeQuestion(JudgeQuestion judgeQuestion) { 20 | return judgeQuestionMapper.addJudgeQuestion(judgeQuestion); 21 | } 22 | 23 | @Override 24 | public JudgeQuestion judgeQuestionId() { 25 | return judgeQuestionMapper.judgeQuestionId(); 26 | } 27 | 28 | @Override 29 | public List getJudgeQuestionByPaperId(int paperId) { 30 | return judgeQuestionMapper.getJudgeQuestionByPaperId(paperId); 31 | } 32 | 33 | @Override 34 | public int updateQuestion(JudgeQuestion judgeQuestion) { 35 | return judgeQuestionMapper.updateQuestion(judgeQuestion); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/ItemController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.util.ApiResult; 4 | import com.example.onlineexam.pojo.Item; 5 | import com.example.onlineexam.service.ItemService; 6 | import com.example.onlineexam.util.ApiResultHandler; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | @RestController 13 | public class ItemController { 14 | @Autowired 15 | private ItemService itemService; 16 | @PostMapping("item") 17 | public ApiResult item(@RequestBody Item item){ 18 | Integer changeNumber = item.getChangeNumber(); 19 | Integer fillNumber = item.getFillNumber(); 20 | Integer judgeNumber = item.getJudgeNumber(); 21 | Integer paperId = item.getPaperId(); 22 | String subject = item.getSubject(); 23 | if(changeNumber==null && fillNumber==null && judgeNumber==null){ 24 | return ApiResultHandler.buildApiResult(400, "题型数量不能全为空", null); 25 | }else { 26 | itemService.cleanPaper(paperId); 27 | ApiResult apiResult = itemService.randItem(item); 28 | return apiResult; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /前端/exam/src/components/common/navigator.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 41 | 42 | 52 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/FillQuestionController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.util.ApiResult; 4 | import com.example.onlineexam.pojo.FillQuestion; 5 | import com.example.onlineexam.service.FillQuestionService; 6 | import com.example.onlineexam.util.ApiResultHandler; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | @RestController 14 | public class FillQuestionController { 15 | @Autowired 16 | private FillQuestionService fillQuestionService; 17 | @PostMapping("fillQuestion") 18 | public ApiResult fillQuestion(@RequestBody FillQuestion fillQuestion){ 19 | int i = fillQuestionService.addFillQuestion(fillQuestion); 20 | if(i==1){ 21 | return ApiResultHandler.buildApiResult(200, "添加成功",i); 22 | } 23 | return ApiResultHandler.buildApiResult(400, "添加失败", i); 24 | } 25 | @GetMapping("fillQuestionId") 26 | public ApiResult fillQuestionId(){ 27 | FillQuestion fillQuestion = fillQuestionService.fillQuestionId(); 28 | return ApiResultHandler.buildApiResult(200, "查询填空题ID", fillQuestion); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/JudgeQuestionController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.util.ApiResult; 4 | import com.example.onlineexam.pojo.JudgeQuestion; 5 | import com.example.onlineexam.service.JudgeQuestionService; 6 | import com.example.onlineexam.util.ApiResultHandler; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | @RestController 14 | public class JudgeQuestionController { 15 | @Autowired 16 | private JudgeQuestionService judgeQuestionService; 17 | @PostMapping("judgeQuestion") 18 | public ApiResult judgeQuestion(@RequestBody JudgeQuestion judgeQuestion){ 19 | int i = judgeQuestionService.addJudgeQuestion(judgeQuestion); 20 | if(i==1){ 21 | return ApiResultHandler.buildApiResult(200, "添加成功", i); 22 | } 23 | return ApiResultHandler.buildApiResult(400, "添加失败", i); 24 | } 25 | @GetMapping("judgeQuestionId") 26 | public ApiResult judgeQuestionId(){ 27 | JudgeQuestion judgeQuestion = judgeQuestionService.judgeQuestionId(); 28 | return ApiResultHandler.buildApiResult(200, "查询判断题ID", judgeQuestion); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/MultiQuestionController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.util.ApiResult; 4 | import com.example.onlineexam.pojo.MultiQuestion; 5 | import com.example.onlineexam.service.MultiQuestionService; 6 | import com.example.onlineexam.util.ApiResultHandler; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | @RestController 14 | public class MultiQuestionController { 15 | @Autowired 16 | private MultiQuestionService multiQuestionService; 17 | @PostMapping("MultiQuestion") 18 | public ApiResult MultiQuestion(@RequestBody MultiQuestion multiQuestion){ 19 | int i = multiQuestionService.addMultiQuestion(multiQuestion); 20 | if (i==1){ 21 | return ApiResultHandler.buildApiResult(200, "添加成功", i); 22 | } 23 | return ApiResultHandler.buildApiResult(400, "添加失败", i); 24 | } 25 | @GetMapping("multiQuestionId") 26 | public ApiResult multiQuestionId(){ 27 | MultiQuestion multiQuestion = multiQuestionService.multiQuestionId(); 28 | return ApiResultHandler.buildApiResult(200, "查询选择题Id", multiQuestion); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /前端/exam/build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/TeacherMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.Teacher; 4 | import org.apache.ibatis.annotations.Delete; 5 | import org.apache.ibatis.annotations.Insert; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.apache.ibatis.annotations.Update; 8 | 9 | import java.util.List; 10 | 11 | public interface TeacherMapper { 12 | @Select("select * from teacher") 13 | List selectAllTeacher(); 14 | 15 | @Insert("insert into " + 16 | "teacher(teacherName,sex,tel,email,pwd,cardId,role,type,institute) " + 17 | "values(#{teacherName},#{sex},#{tel},#{email},#{pwd},#{cardId},#{role},#{type},#{institute})") 18 | Integer addTeacher(Teacher teacher); 19 | 20 | @Select("select * from teacher where teacherId=#{id}") 21 | Teacher selectTeacherById(Integer id); 22 | 23 | @Update("update teacher " + 24 | "set teacherName = #{teacherName},sex = #{sex},tel = #{tel}, email = #{email},pwd = #{pwd},cardId = #{cardId},role = #{role},institute = #{institute},type = #{type} " + 25 | "where teacherId = #{teacherId}") 26 | Integer updateTeacher(Teacher teacher); 27 | 28 | @Delete("delete from teacher where teacherId=#{id}") 29 | Integer deleteTeacher(Integer id); 30 | 31 | /** 32 | * 更新密码 33 | * @param teacher 34 | * @return 受影响的记录条数 35 | */ 36 | @Update("update teacher set pwd = #{pwd} where teacherId = #{teacherId}") 37 | int updatePwdTeacher(Teacher teacher); 38 | } 39 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/StudentMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.Student; 4 | import org.apache.ibatis.annotations.Delete; 5 | import org.apache.ibatis.annotations.Insert; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.apache.ibatis.annotations.Update; 8 | 9 | import java.util.List; 10 | 11 | public interface StudentMapper { 12 | @Select("select * from student") 13 | List selectAllStudent(); 14 | 15 | @Select("select * from student where studentId=#{id}") 16 | Student selectStudentById(Integer id); 17 | 18 | @Update("update student " + 19 | "set studentName = #{studentName},grade = #{grade},major = #{major},clazz = #{clazz}," + 20 | "institute = #{institute},tel = #{tel},email = #{email},pwd = #{pwd},cardId = #{cardId},sex = #{sex},role = #{role} " + 21 | "where studentId = #{studentId}") 22 | Integer updateStudent(Student student); 23 | 24 | @Insert("insert into " + 25 | "student(studentName,grade,major,clazz,institute,tel,email,pwd,cardId,sex,role) values " + 26 | "(#{studentName},#{grade},#{major},#{clazz},#{institute},#{tel},#{email},#{pwd},#{cardId},#{sex},#{role})") 27 | Integer addStudent(Student student); 28 | 29 | @Delete("delete from student where studentId = #{id}") 30 | Integer deleteStudentById(Integer id); 31 | 32 | @Update("update student set pwd = #{pwd} where studentId = #{studentId}") 33 | Integer updateStudentPwd(Student student); 34 | } 35 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/MessageController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.pojo.Message; 4 | import com.example.onlineexam.service.MessageService; 5 | import com.example.onlineexam.util.ApiResult; 6 | import com.example.onlineexam.util.ApiResultHandler; 7 | import com.example.onlineexam.util.PageBean; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | @RestController 12 | public class MessageController { 13 | @Autowired 14 | private MessageService messageService; 15 | @PostMapping("message") 16 | public ApiResult addMessage(@RequestBody Message message){ 17 | int i = messageService.addMessage(message); 18 | if(i==1){ 19 | return ApiResultHandler.buildApiResult(200, "添加留言成功", i); 20 | } 21 | else { 22 | return ApiResultHandler.buildApiResult(400, "添加留言失败", i); 23 | } 24 | } 25 | @GetMapping("messages/{page}/{size}") 26 | public ApiResult messages(@PathVariable("page") Integer page,@PathVariable("size") Integer size){ 27 | PageBean messagePageBean = messageService.MessageByPage(page, size); 28 | return ApiResultHandler.buildApiResult(200, "分页查找成功", messagePageBean); 29 | } 30 | @GetMapping("/message/{id}") 31 | public ApiResult selectById(@PathVariable("id") Integer id){ 32 | Message message = messageService.selectById(id); 33 | return ApiResultHandler.buildApiResult(200, "查询消息", message); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/ScoreController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.util.ApiResult; 4 | import com.example.onlineexam.pojo.Score; 5 | import com.example.onlineexam.service.ScoreService; 6 | import com.example.onlineexam.util.ApiResultHandler; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import java.util.List; 11 | 12 | @RestController 13 | public class ScoreController { 14 | @Autowired 15 | private ScoreService scoreService; 16 | 17 | @GetMapping("score/{studentId}") 18 | public ApiResult score(@PathVariable("studentId") int studentId){ 19 | List score = scoreService.getScoreByStudentId(studentId); 20 | if(score.size()==0){ 21 | return ApiResultHandler.buildApiResult(400, "未查到成绩", score); 22 | } 23 | return ApiResultHandler.buildApiResult(200, "查询成功", score); 24 | } 25 | @GetMapping("scores/{examCode}") 26 | public ApiResult scores(@PathVariable("examCode") int examCode){ 27 | List score = scoreService.getScoreByExamCode(examCode); 28 | return ApiResultHandler.buildApiResult(200, "查询成功", score); 29 | } 30 | @PostMapping("score") 31 | public ApiResult getScore(@RequestBody Score score){ 32 | int i = scoreService.addScore(score); 33 | if(i==1){ 34 | return ApiResultHandler.buildApiResult(200, "增加成绩成功", i); 35 | } 36 | else { 37 | return ApiResultHandler.buildApiResult(400, "增加成绩失败", i); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/interceptor/LoginInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.interceptor; 2 | 3 | import org.springframework.web.servlet.HandlerInterceptor; 4 | import org.springframework.web.servlet.ModelAndView; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | import javax.servlet.http.HttpSession; 9 | 10 | public class LoginInterceptor implements HandlerInterceptor { 11 | 12 | 13 | @Override 14 | public boolean preHandle(HttpServletRequest request, 15 | HttpServletResponse response, Object handler) throws Exception { 16 | 17 | HttpSession session = request.getSession(); 18 | String st= (String) session.getAttribute("student"); 19 | String ad= (String) session.getAttribute("admin"); 20 | String te= (String) session.getAttribute("teacher"); 21 | 22 | if(st != null){ 23 | return true; 24 | } 25 | if(ad != null){ 26 | return true; 27 | } 28 | if(te != null){ 29 | return true; 30 | } 31 | else{ 32 | response.sendRedirect("/login"); 33 | return false; 34 | } 35 | 36 | 37 | 38 | } 39 | 40 | @Override 41 | public void postHandle(HttpServletRequest request, 42 | HttpServletResponse response, Object handler, 43 | ModelAndView modelAndView) throws Exception { 44 | // TODO Auto-generated method stub 45 | 46 | } 47 | 48 | @Override 49 | public void afterCompletion(HttpServletRequest request, 50 | HttpServletResponse response, Object handler, Exception ex) 51 | throws Exception { 52 | // TODO Auto-generated method stub 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/MultiQuestionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.MultiQuestionMapper; 4 | import com.example.onlineexam.pojo.MultiQuestion; 5 | import com.example.onlineexam.service.MultiQuestionService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.transaction.annotation.Transactional; 9 | 10 | import java.util.List; 11 | 12 | @Service 13 | public class MultiQuestionServiceImpl implements MultiQuestionService { 14 | @Autowired 15 | private MultiQuestionMapper multiQuestionMapper; 16 | 17 | @Override 18 | @Transactional 19 | public int addMultiQuestion(MultiQuestion multiQuestion) { 20 | return multiQuestionMapper.addMultiQuestion(multiQuestion); 21 | } 22 | 23 | @Override 24 | public MultiQuestion multiQuestionId() { 25 | return multiQuestionMapper.multiQuestionId(); 26 | } 27 | 28 | @Override 29 | public List getmultiQuestionByPaperId(int paperId) { 30 | return multiQuestionMapper.getmultiQuestionByPaperId(paperId); 31 | } 32 | 33 | @Override 34 | public MultiQuestion selectById(Integer questionId) { 35 | return multiQuestionMapper.selectById(questionId); 36 | } 37 | 38 | @Override 39 | public int updateQuestion(MultiQuestion multiQuestion) { 40 | return multiQuestionMapper.updateQuestion(multiQuestion); 41 | } 42 | 43 | @Override 44 | public int deleteById(Integer questionId) { 45 | return multiQuestionMapper.deleteById(questionId); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/ItemMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import org.apache.ibatis.annotations.Delete; 4 | import org.apache.ibatis.annotations.Insert; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | public interface ItemMapper { 11 | @Select("select questionId from multiquestion " + 12 | "WHERE subject=#{subject} and level=#{level} " + 13 | "order by rand() limit #{changeNumber}") 14 | List randMultiQuestion(@Param("subject") String subject,@Param("changeNumber") Integer changeNumber,@Param("level") Integer level); 15 | 16 | @Select("select questionId from fillquestion " + 17 | "WHERE subject=#{subject} and level=#{level} " + 18 | "order by rand() limit #{fillNumber}") 19 | List randFillQuestion(@Param("subject") String subject, @Param("fillNumber") Integer fillNumber,@Param("level") Integer level); 20 | 21 | @Select("select questionId from judgequestion " + 22 | "WHERE subject=#{subject} and level=#{level} " + 23 | "order by rand() limit #{judgeNumber}") 24 | List randJudgeQuestion(@Param("subject") String subject, @Param("judgeNumber") Integer judgeNumber,@Param("level") Integer level); 25 | 26 | @Insert("insert into papermanage(paperId,questionType,questionId) " + 27 | "values(#{paperId},#{i},#{integer})") 28 | int addQuestion(@Param("integer") Integer integer, @Param("paperId") Integer paperId, @Param("i") int i); 29 | 30 | @Delete("delete from papermanage where paperId=#{paperId}") 31 | int cleanPaper(Integer paperId); 32 | } 33 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/JudgeQuestionMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.JudgeQuestion; 4 | import org.apache.ibatis.annotations.Delete; 5 | import org.apache.ibatis.annotations.Insert; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.apache.ibatis.annotations.Update; 8 | 9 | import java.util.List; 10 | 11 | public interface JudgeQuestionMapper { 12 | @Insert("insert into " + 13 | "judgequestion(subject,question,answer,analysis,level,section) values " + 14 | "(#{subject},#{question},#{answer},#{analysis},#{level},#{section})") 15 | int addJudgeQuestion(JudgeQuestion judgeQuestion); 16 | 17 | @Select("SELECT questionId FROM judgequestion WHERE questionId=(" + 18 | "SELECT MAX(questionId) FROM judgequestion)") 19 | JudgeQuestion judgeQuestionId(); 20 | 21 | @Select("select * from judgequestion where questionId in " + 22 | "(select questionId from papermanage " + 23 | "where questionType = 3 and paperId = #{paperId})") 24 | List getJudgeQuestionByPaperId(int paperId); 25 | 26 | @Select("select * from judgequestion where questionId=#{questionId}") 27 | JudgeQuestion selectById(Integer questionId); 28 | 29 | @Update("update judgequestion " + 30 | "set subject=#{subject},question=#{question},answer=#{answer},analysis=#{analysis},score=#{score},level=#{level},section=#{section} " + 31 | "where questionId=#{questionId}") 32 | int updateQuestion(JudgeQuestion judgeQuestion); 33 | 34 | @Delete("delete from judgequestion where questionId=#{questionId}") 35 | int deleteById(Integer questionId); 36 | } 37 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/FillQuestionMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.FillQuestion; 4 | import com.example.onlineexam.pojo.MultiQuestion; 5 | import org.apache.ibatis.annotations.Delete; 6 | import org.apache.ibatis.annotations.Insert; 7 | import org.apache.ibatis.annotations.Select; 8 | import org.apache.ibatis.annotations.Update; 9 | 10 | import java.util.List; 11 | 12 | public interface FillQuestionMapper { 13 | @Insert("insert into " + 14 | "fillquestion(subject,question,answer,analysis,level,section) " + 15 | "values (#{subject,},#{question},#{answer},#{analysis},#{level},#{section})") 16 | int addFillQuestion(FillQuestion fillQuestion); 17 | 18 | @Select("SELECT questionId FROM fillquestion WHERE questionId=(" + 19 | "SELECT MAX(questionId) FROM fillquestion)") 20 | FillQuestion fillQuestionId(); 21 | 22 | @Select("select * from fillquestion where questionId in " + 23 | "(select questionId from papermanage " + 24 | "where questionType = 2 and paperId = #{paperId})") 25 | List getFillQuestionByPaperId(int paperId); 26 | 27 | @Select("select * from fillquestion where questionId=#{questionId}") 28 | FillQuestion selectById(Integer questionId); 29 | 30 | @Update("update fillquestion " + 31 | "set subject=#{subject},question=#{question},answer=#{answer},analysis=#{analysis},score=#{score},level=#{level},section=#{section} " + 32 | "where questionId=#{questionId}") 33 | int updateQuestion(FillQuestion fillQuestion); 34 | 35 | @Delete("delete from fillquestion where questionId=#{questionId}") 36 | int deleteById(Integer questionId); 37 | } 38 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/ExamManageMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.ExamManage; 4 | import org.apache.ibatis.annotations.Delete; 5 | import org.apache.ibatis.annotations.Insert; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.apache.ibatis.annotations.Update; 8 | 9 | import java.util.List; 10 | 11 | public interface ExamManageMapper { 12 | @Select("SELECT * FROM exammanage") 13 | List selectAllExamManage(); 14 | 15 | @Select("SELECT * FROM exammanage WHERE paperId IN (SELECT paperId FROM papermanage)") 16 | List selectPartExamManage(); 17 | 18 | @Select("SELECT MAX(paperId) FROM exammanage") 19 | Integer examManagePaperId(); 20 | 21 | @Insert("insert into exammanage" + 22 | "(description,source,paperId,examDate,totalTime,grade,term,major,institute,totalScore,type,tips)" + 23 | " values(#{description},#{source},#{paperId},#{examDate},#{totalTime},#{grade},#{term},#{major},#{institute},#{totalScore},#{type},#{tips})") 24 | Integer addExam(ExamManage examManage); 25 | 26 | @Select("select * from exammanage where examCode=#{id}") 27 | ExamManage selectExamManageById(Integer id); 28 | 29 | @Update("update exammanage " + 30 | "set description = #{description},source = #{source},paperId = #{paperId},examDate = #{examDate},totalTime = #{totalTime},grade = #{grade},term = #{term},major = #{major},institute = #{institute},totalScore = #{totalScore},type = #{type},tips = #{tips} " + 31 | "where examCode = #{examCode}") 32 | Integer updateExam(ExamManage examManage); 33 | 34 | @Delete("delete from exammanage where examCode = #{id}") 35 | Integer deleteExam(Integer id); 36 | 37 | @Select("select * from exammanage") 38 | List selectAll(); 39 | } 40 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/mapper/MultiQuestionMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.mapper; 2 | 3 | import com.example.onlineexam.pojo.MultiQuestion; 4 | import org.apache.ibatis.annotations.Delete; 5 | import org.apache.ibatis.annotations.Insert; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.apache.ibatis.annotations.Update; 8 | 9 | import java.util.List; 10 | 11 | public interface MultiQuestionMapper { 12 | @Insert("insert into " + 13 | "multiquestion(subject,question,answerA,answerB,answerC,answerD,rightAnswer,analysis,section,level) " + 14 | "values(#{subject},#{question},#{answerA},#{answerB},#{answerC},#{answerD},#{rightAnswer},#{analysis},#{section},#{level})") 15 | int addMultiQuestion(MultiQuestion multiQuestion); 16 | 17 | @Select("SELECT questionId FROM multiquestion WHERE questionId=(" + 18 | "SELECT MAX(questionId) FROM multiquestion)") 19 | MultiQuestion multiQuestionId(); 20 | 21 | @Select("select * from multiquestion where questionId in " + 22 | "(select questionId from papermanage " + 23 | "where questionType = 1 and paperId = #{paperId})") 24 | List getmultiQuestionByPaperId(int paperId); 25 | 26 | @Select("select * from multiquestion where questionId=#{questionId}") 27 | MultiQuestion selectById(Integer questionId); 28 | 29 | @Update("update multiquestion " + 30 | "set subject=#{subject},question=#{question},answerA=#{answerA},answerB=#{answerB},answerC=#{answerC},answerD=#{answerD}," + 31 | "rightAnswer=#{rightAnswer},analysis=#{analysis},score=#{score},section=#{section},level=#{level} where questionId=#{questionId}") 32 | int updateQuestion(MultiQuestion multiQuestion); 33 | 34 | @Delete("delete from multiquestion where questionId=#{questionId}") 35 | int deleteById(Integer questionId); 36 | } 37 | -------------------------------------------------------------------------------- /前端/exam/src/components/common/hello.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 51 | 52 | 53 | 87 | 88 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/TeacherServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.TeacherMapper; 4 | import com.example.onlineexam.pojo.Teacher; 5 | import com.example.onlineexam.service.TeacherService; 6 | import com.example.onlineexam.util.MD5EncodingUtil; 7 | import com.example.onlineexam.util.PageBean; 8 | import com.github.pagehelper.PageHelper; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import java.util.List; 14 | 15 | @Service 16 | public class TeacherServiceImpl implements TeacherService { 17 | @Autowired 18 | private TeacherMapper teacherMapper; 19 | 20 | @Override 21 | public PageBean selectTeacherByPage(Integer page, Integer size) { 22 | PageHelper.startPage(page, size); 23 | List teachers = teacherMapper.selectAllTeacher(); 24 | PageBean teacherPageInfo = new PageBean<>(teachers,size); 25 | return teacherPageInfo; 26 | } 27 | 28 | @Override 29 | @Transactional 30 | public Integer addTeacher(Teacher teacher) { 31 | return teacherMapper.addTeacher(teacher); 32 | } 33 | 34 | @Override 35 | public Teacher selectTeacherById(Integer id) { 36 | return teacherMapper.selectTeacherById(id); 37 | } 38 | 39 | @Override 40 | @Transactional 41 | public Integer updateTeacher(Teacher teacher) { 42 | return teacherMapper.updateTeacher(teacher); 43 | } 44 | 45 | @Override 46 | @Transactional 47 | public Integer deleteTeacher(Integer id) { 48 | return teacherMapper.deleteTeacher(id); 49 | } 50 | 51 | @Override 52 | public int updatePwdTeacher(Teacher teacher) { 53 | teacher.setPwd(MD5EncodingUtil.getMD5(teacher.getPwd())); 54 | return teacherMapper.updatePwdTeacher(teacher); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /前端/exam/src/vuex/store.js: -------------------------------------------------------------------------------- 1 | import VUE from 'vue' 2 | import VUEX from 'vuex' 3 | 4 | VUE.use(VUEX) 5 | 6 | const state = { 7 | isPractice: false, //练习模式标志 8 | flag: false, //菜单栏左右滑动标志 9 | userInfo: null, 10 | menu: [{ 11 | index: '1', 12 | title: '考试管理', 13 | icon: 'icon-kechengbiao', 14 | content:[{item2:'考试查询',path:'selectExam'},{item3:'添加考试',path:'/addExam'}], 15 | }, 16 | { 17 | index: '2', 18 | title: '题库管理', 19 | icon: 'icon-tiku', 20 | content:[{item2:'所有题库',path:'/selectAnswer'},{item3:'增加题库',path:'/addAnswer'},{path: '/addAnswerChildren'}], 21 | }, 22 | { 23 | index: '3', 24 | title: '成绩查询', 25 | icon: 'icon-performance', 26 | content:[{item1:'学生成绩查询',path:'/allStudentsGrade'},{path: '/grade'},{item2: '成绩分段查询',path: '/selectExamToPart'},{path: '/scorePart'}], 27 | }, 28 | { 29 | index: '4', 30 | title: '学生管理', 31 | icon: 'icon-role', 32 | content:[{item1:'学生管理',path:'/studentManage'},{item2: '添加学生',path: '/addStudent'}], 33 | }, 34 | // { 35 | // index: '5', 36 | // title: '教师管理', 37 | // icon: 'icon-Userselect', 38 | // content:[{item1:'教师管理',path:'/teacherManage'},{item2: '添加教师',path: '/addTeacher'}], 39 | // }, 40 | // { 41 | // index: '7', 42 | // title: '模块管理', 43 | // icon: 'icon-module4mokuai', 44 | // content:[{item1:'模块操作',path:'/module'}], 45 | // } 46 | ], 47 | } 48 | const mutations = { 49 | practice(state,status) { 50 | state.isPractice = status 51 | }, 52 | toggle(state) { 53 | state.flag = !state.flag 54 | }, 55 | changeUserInfo(state,info) { 56 | state.userInfo = info 57 | } 58 | } 59 | const getters = { 60 | 61 | } 62 | const actions = { 63 | getUserInfo(context,info) { 64 | context.commit('changeUserInfo',info) 65 | }, 66 | getPractice(context,status) { 67 | context.commit('practice',status) 68 | } 69 | } 70 | export default new VUEX.Store({ 71 | state, 72 | mutations, 73 | getters, 74 | actions, 75 | // store 76 | }) 77 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/StudentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.StudentMapper; 4 | import com.example.onlineexam.pojo.Student; 5 | import com.example.onlineexam.service.StudentService; 6 | import com.example.onlineexam.util.MD5EncodingUtil; 7 | import com.example.onlineexam.util.PageBean; 8 | import com.github.pagehelper.PageHelper; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import java.util.List; 14 | 15 | @Service 16 | public class StudentServiceImpl implements StudentService { 17 | @Autowired 18 | private StudentMapper studentMapper; 19 | @Override 20 | public PageBean selectStudentByPage(Integer page, Integer size) { 21 | PageHelper.startPage(page, size); 22 | List students = studentMapper.selectAllStudent(); 23 | PageBean studentPageInfo = new PageBean<>(students,size); 24 | return studentPageInfo; 25 | } 26 | 27 | @Override 28 | public Student selectStudentById(Integer id) { 29 | return studentMapper.selectStudentById(id); 30 | } 31 | 32 | @Override 33 | @Transactional 34 | public Integer updateStudent(Student student) { 35 | return studentMapper.updateStudent(student); 36 | } 37 | 38 | @Override 39 | @Transactional 40 | public Integer addStudent(Student student) { 41 | student.setPwd(MD5EncodingUtil.getMD5(student.getPwd())); 42 | return studentMapper.addStudent(student); 43 | } 44 | 45 | @Override 46 | @Transactional 47 | public Integer deleteStudent(Integer id) { 48 | return studentMapper.deleteStudentById(id); 49 | } 50 | 51 | @Override 52 | public Integer updateStudentPwd(Student student) { 53 | student.setPwd(MD5EncodingUtil.getMD5(student.getPwd())); 54 | return studentMapper.updateStudentPwd(student); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/PaperManageController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.pojo.*; 4 | import com.example.onlineexam.service.FillQuestionService; 5 | import com.example.onlineexam.service.JudgeQuestionService; 6 | import com.example.onlineexam.service.MultiQuestionService; 7 | import com.example.onlineexam.service.PaperManageService; 8 | import com.example.onlineexam.util.ApiResult; 9 | import com.example.onlineexam.util.ApiResultHandler; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | @RestController 18 | public class PaperManageController { 19 | @Autowired 20 | private PaperManageService paperManageService; 21 | @Autowired 22 | private MultiQuestionService multiQuestionService; 23 | @Autowired 24 | private FillQuestionService fillQuestionService; 25 | @Autowired 26 | private JudgeQuestionService judgeQuestionService; 27 | @PostMapping("paperManage") 28 | public ApiResult paperManage(@RequestBody PaperManage paperManage){ 29 | int i = paperManageService.addPaper(paperManage); 30 | if(i==1){ 31 | return ApiResultHandler.buildApiResult(200, "添加成功", i); 32 | } 33 | return ApiResultHandler.buildApiResult(400, "添加失败", i); 34 | } 35 | @GetMapping("paper/{paperId}") 36 | public Map paper(@PathVariable("paperId") int paperId){ 37 | List multiQuestions = multiQuestionService.getmultiQuestionByPaperId(paperId); 38 | List fillQuestions = fillQuestionService.getFillQuestionByPaperId(paperId); 39 | List judgeQuestions = judgeQuestionService.getJudgeQuestionByPaperId(paperId); 40 | Map map = new HashMap<>(); 41 | map.put(1, multiQuestions); 42 | map.put(2, fillQuestions); 43 | map.put(3, judgeQuestions); 44 | return map; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.pojo.Admin; 4 | import com.example.onlineexam.pojo.Student; 5 | import com.example.onlineexam.pojo.Teacher; 6 | import com.example.onlineexam.util.ApiResult; 7 | import com.example.onlineexam.pojo.Login; 8 | import com.example.onlineexam.service.LoginService; 9 | import com.example.onlineexam.util.ApiResultHandler; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.PostMapping; 12 | import org.springframework.web.bind.annotation.RequestBody; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RestController; 15 | import org.springframework.web.client.RestTemplate; 16 | 17 | import javax.servlet.http.HttpServletRequest; 18 | import javax.servlet.http.HttpSession; 19 | import java.util.Enumeration; 20 | 21 | @RestController 22 | public class LoginController { 23 | @Autowired 24 | private LoginService loginService; 25 | 26 | 27 | @PostMapping("login") 28 | public ApiResult login(@RequestBody Login login, HttpServletRequest request){ 29 | 30 | Integer username = login.getUsername(); 31 | String password = login.getPassword(); 32 | Admin adminRes = loginService.adminLogin(username, password); 33 | if (adminRes != null) { 34 | request.getSession().setAttribute("admin","admin"); 35 | return ApiResultHandler.buildApiResult(200, "请求成功", adminRes); 36 | } 37 | 38 | Teacher teacherRes = loginService.teacherLogin(username,password); 39 | if (teacherRes != null) { 40 | request.getSession().setAttribute("teacher","teacher"); 41 | return ApiResultHandler.buildApiResult(200, "请求成功", teacherRes); 42 | } 43 | 44 | Student studentRes = loginService.studentLogin(username,password); 45 | if (studentRes != null) { 46 | request.getSession().setAttribute("student","student"); 47 | return ApiResultHandler.buildApiResult(200, "请求成功", studentRes); 48 | } 49 | 50 | return ApiResultHandler.buildApiResult(400, "请求失败", null); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /后端/online-exam/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 1.5.19.RELEASE 9 | 10 | 11 | com.example 12 | online-exam 13 | 0.0.1-SNAPSHOT 14 | online-exam 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-web 25 | 26 | 27 | org.mybatis.spring.boot 28 | mybatis-spring-boot-starter 29 | 2.0.1 30 | 31 | 32 | 33 | mysql 34 | mysql-connector-java 35 | runtime 36 | 37 | 38 | org.projectlombok 39 | lombok 40 | true 41 | 42 | 43 | org.springframework.boot 44 | spring-boot-starter-test 45 | test 46 | 47 | 48 | com.github.pagehelper 49 | pagehelper-spring-boot-starter 50 | 1.2.5 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | org.springframework.boot 63 | spring-boot-maven-plugin 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /前端/exam/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-init", 3 | "version": "1.0.0", 4 | "description": "vue demo", 5 | "author": "", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "build": "node build/build.js" 11 | }, 12 | "dependencies": { 13 | "@babel/preset-es2015": "^7.0.0-beta.53", 14 | "axios": "^0.18.0", 15 | "echarts": "^4.2.0-rc.2", 16 | "element-ui": "^2.4.11", 17 | "vis": "^4.21.0", 18 | "vue": "^2.5.2", 19 | "vue-cookies": "^1.5.12", 20 | "vue-router": "^3.0.1", 21 | "vuex": "^3.0.1", 22 | "vuex-persistedstate": "^2.5.4" 23 | }, 24 | "devDependencies": { 25 | "@babel/core": "^7.2.2", 26 | "@babel/preset-env": "^7.2.3", 27 | "autoprefixer": "^7.1.2", 28 | "babel-core": "^6.22.1", 29 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 30 | "babel-loader": "^7.1.5", 31 | "babel-plugin-syntax-jsx": "^6.18.0", 32 | "babel-plugin-transform-runtime": "^6.22.0", 33 | "babel-plugin-transform-vue-jsx": "^3.5.0", 34 | "babel-preset-env": "^1.3.2", 35 | "babel-preset-stage-2": "^6.22.0", 36 | "chalk": "^2.0.1", 37 | "copy-webpack-plugin": "^4.0.1", 38 | "css-loader": "^0.28.0", 39 | "extract-text-webpack-plugin": "^3.0.0", 40 | "file-loader": "^1.1.4", 41 | "friendly-errors-webpack-plugin": "^1.6.1", 42 | "html-webpack-plugin": "^2.30.1", 43 | "node-notifier": "^5.1.2", 44 | "node-sass": "^4.11.0", 45 | "optimize-css-assets-webpack-plugin": "^3.2.0", 46 | "ora": "^1.2.0", 47 | "portfinder": "^1.0.13", 48 | "postcss-import": "^11.0.0", 49 | "postcss-loader": "^2.0.8", 50 | "postcss-url": "^7.2.1", 51 | "rimraf": "^2.6.0", 52 | "sass-loader": "^7.1.0", 53 | "semver": "^5.3.0", 54 | "shelljs": "^0.7.6", 55 | "uglifyjs-webpack-plugin": "^1.1.1", 56 | "url-loader": "^0.5.8", 57 | "vue-loader": "^13.3.0", 58 | "vue-style-loader": "^3.0.1", 59 | "vue-template-compiler": "^2.5.2", 60 | "webpack": "^3.12.0", 61 | "webpack-bundle-analyzer": "^2.9.0", 62 | "webpack-dev-server": "^2.9.1", 63 | "webpack-merge": "^4.1.0" 64 | }, 65 | "engines": { 66 | "node": ">= 6.0.0", 67 | "npm": ">= 3.0.0" 68 | }, 69 | "browserslist": [ 70 | "> 1%", 71 | "last 2 versions", 72 | "not ie <= 8" 73 | ] 74 | } 75 | -------------------------------------------------------------------------------- /前端/exam/src/components/admin/addTeacher.vue: -------------------------------------------------------------------------------- 1 | 2 | 36 | 37 | 81 | 87 | 88 | -------------------------------------------------------------------------------- /前端/exam/config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.3.1 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | 10 | // Paths 11 | assetsSubDirectory: 'static', 12 | assetsPublicPath: '/', 13 | proxyTable: { 14 | '/api': { 15 | target: 'http://localhost:8081',//本地地址http://47.94.224.43 16 | // target: 'http://huangxl.xyz:8081',// 线上部署地址 17 | changeOrigin: true, 18 | pathRewrite: { 19 | '^/api': ''//这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可 20 | } 21 | } 22 | }, 23 | 24 | // Various Dev Server settings 25 | host: 'localhost', // can be overwritten by process.env.HOST 26 | port: 8088, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 27 | autoOpenBrowser: false, 28 | errorOverlay: true, 29 | notifyOnErrors: true, 30 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 31 | 32 | 33 | /** 34 | * Source Maps 35 | */ 36 | 37 | // https://webpack.js.org/configuration/devtool/#development 38 | devtool: 'cheap-module-eval-source-map', 39 | 40 | // If you have problems debugging vue-files in devtools, 41 | // set this to false - it *may* help 42 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 43 | cacheBusting: true, 44 | 45 | cssSourceMap: true 46 | }, 47 | 48 | build: { 49 | // Template for index.html 50 | index: path.resolve(__dirname, '../dist/index.html'), 51 | 52 | // Paths 53 | assetsRoot: path.resolve(__dirname, '../dist'), 54 | assetsSubDirectory: 'static', 55 | assetsPublicPath: './', 56 | 57 | /** 58 | * Source Maps 59 | */ 60 | 61 | productionSourceMap: true, 62 | // https://webpack.js.org/configuration/devtool/#production 63 | devtool: '#source-map', 64 | 65 | // Gzip off by default as many popular static hosts such as 66 | // Surge or Netlify already gzip all static assets for you. 67 | // Before setting to `true`, make sure to: 68 | // npm install --save-dev compression-webpack-plugin 69 | productionGzip: false, 70 | productionGzipExtensions: ['js', 'css'], 71 | 72 | // Run the build command with an extra argument to 73 | // View the bundle analyzer report after build finishes: 74 | // `npm run build --report` 75 | // Set to `true` or `false` to always turn it on or off 76 | bundleAnalyzerReport: process.env.npm_config_report 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /前端/exam/src/components/teacher/addStudent.vue: -------------------------------------------------------------------------------- 1 | 2 | 42 | 43 | 87 | 93 | 94 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/ExamManageServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.ExamManageMapper; 4 | import com.example.onlineexam.pojo.ExamManage; 5 | import com.example.onlineexam.service.ExamManageService; 6 | import com.example.onlineexam.util.PageBean; 7 | import com.github.pagehelper.PageHelper; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | import java.util.List; 13 | 14 | @Service 15 | public class ExamManageServiceImpl implements ExamManageService { 16 | @Autowired 17 | private ExamManageMapper examManageMapper; 18 | @Override 19 | public PageBean selectExamManageByPage(Integer page, Integer size) { 20 | PageHelper.startPage(page, size); 21 | List examManages = examManageMapper.selectAllExamManage(); 22 | PageBean examManagePageBean = new PageBean<>(examManages,size); 23 | return examManagePageBean; 24 | } 25 | 26 | @Override 27 | public PageBean selectPartExamManageByPage(Integer page, Integer size) { 28 | PageHelper.startPage(page, size); 29 | List examManages = examManageMapper.selectPartExamManage(); 30 | PageBean examManagePageBean = new PageBean<>(examManages,size); 31 | return examManagePageBean; 32 | } 33 | 34 | @Override 35 | public List selectPartExamManage() { 36 | return examManageMapper.selectPartExamManage(); 37 | } 38 | 39 | @Override 40 | public Integer examManagePaperId() { 41 | return examManageMapper.examManagePaperId(); 42 | } 43 | 44 | @Override 45 | @Transactional 46 | public Integer addExam(ExamManage examManage) { 47 | Integer integer = examManageMapper.examManagePaperId(); 48 | examManage.setPaperId(integer+1); 49 | return examManageMapper.addExam(examManage); 50 | } 51 | 52 | @Override 53 | public ExamManage selectExamManageById(Integer id) { 54 | return examManageMapper.selectExamManageById(id); 55 | } 56 | 57 | @Override 58 | @Transactional 59 | public Integer updateExam(ExamManage examManage) { 60 | return examManageMapper.updateExam(examManage); 61 | } 62 | 63 | @Override 64 | @Transactional 65 | public Integer deleteExam(Integer id) { 66 | return examManageMapper.deleteExam(id); 67 | } 68 | 69 | @Override 70 | public List selectAll() { 71 | return examManageMapper.selectAll(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /前端/exam/src/components/teacher/allStudentsGrade.vue: -------------------------------------------------------------------------------- 1 | // 所有学生 2 | 30 | 31 | 69 | 93 | -------------------------------------------------------------------------------- /前端/exam/src/components/student/scoreTable.vue: -------------------------------------------------------------------------------- 1 | //显示学生成绩 2 | 35 | 36 | 84 | 85 | 98 | -------------------------------------------------------------------------------- /前端/exam/src/components/teacher/addAnswer.vue: -------------------------------------------------------------------------------- 1 | //获取试卷并跳转到添加题库 2 | 32 | 33 | 71 | 85 | -------------------------------------------------------------------------------- /前端/exam/src/components/teacher/selectExamToPart.vue: -------------------------------------------------------------------------------- 1 | //查询所有考试跳转到分段页面 2 | 32 | 33 | 72 | 86 | -------------------------------------------------------------------------------- /前端/exam/src/components/charts/grade.vue: -------------------------------------------------------------------------------- 1 | // 成绩统计页面 2 | 10 | 11 | 93 | 94 | 108 | -------------------------------------------------------------------------------- /前端/exam/build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const config = require('../config') 4 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 5 | const packageConfig = require('../package.json') 6 | 7 | exports.assetsPath = function (_path) { 8 | const assetsSubDirectory = process.env.NODE_ENV === 'production' 9 | ? config.build.assetsSubDirectory 10 | : config.dev.assetsSubDirectory 11 | 12 | return path.posix.join(assetsSubDirectory, _path) 13 | } 14 | 15 | exports.cssLoaders = function (options) { 16 | options = options || {} 17 | 18 | const cssLoader = { 19 | loader: 'css-loader', 20 | options: { 21 | sourceMap: options.sourceMap 22 | } 23 | } 24 | 25 | const postcssLoader = { 26 | loader: 'postcss-loader', 27 | options: { 28 | sourceMap: options.sourceMap 29 | } 30 | } 31 | 32 | // generate loader string to be used with extract text plugin 33 | function generateLoaders (loader, loaderOptions) { 34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] 35 | 36 | if (loader) { 37 | loaders.push({ 38 | loader: loader + '-loader', 39 | options: Object.assign({}, loaderOptions, { 40 | sourceMap: options.sourceMap 41 | }) 42 | }) 43 | } 44 | 45 | // Extract CSS when that option is specified 46 | // (which is the case during production build) 47 | if (options.extract) { 48 | return ExtractTextPlugin.extract({ 49 | use: loaders, 50 | fallback: 'vue-style-loader' 51 | }) 52 | } else { 53 | return ['vue-style-loader'].concat(loaders) 54 | } 55 | } 56 | 57 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 58 | return { 59 | css: generateLoaders(), 60 | postcss: generateLoaders(), 61 | less: generateLoaders('less'), 62 | sass: generateLoaders('sass', { indentedSyntax: true }), 63 | scss: generateLoaders('sass'), 64 | stylus: generateLoaders('stylus'), 65 | styl: generateLoaders('stylus') 66 | } 67 | } 68 | 69 | // Generate loaders for standalone style files (outside of .vue) 70 | exports.styleLoaders = function (options) { 71 | const output = [] 72 | const loaders = exports.cssLoaders(options) 73 | 74 | for (const extension in loaders) { 75 | const loader = loaders[extension] 76 | output.push({ 77 | test: new RegExp('\\.' + extension + '$'), 78 | use: loader 79 | }) 80 | } 81 | 82 | return output 83 | } 84 | 85 | exports.createNotifierCallback = () => { 86 | const notifier = require('node-notifier') 87 | 88 | return (severity, errors) => { 89 | if (severity !== 'error') return 90 | 91 | const error = errors[0] 92 | const filename = error.file && error.file.split('!').pop() 93 | 94 | notifier.notify({ 95 | title: packageConfig.name, 96 | message: severity + ': ' + error.name, 97 | subtitle: filename || '', 98 | icon: path.join(__dirname, 'logo.png') 99 | }) 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /前端/exam/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const vueLoaderConfig = require('./vue-loader.conf') 6 | 7 | function resolve (dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | 12 | 13 | module.exports = { 14 | context: path.resolve(__dirname, '../'), 15 | entry: { 16 | app: './src/main.js' 17 | }, 18 | output: { 19 | path: config.build.assetsRoot, 20 | filename: '[name].js', 21 | publicPath: process.env.NODE_ENV === 'production' 22 | ? config.build.assetsPublicPath 23 | : config.dev.assetsPublicPath 24 | }, 25 | resolve: { 26 | extensions: ['.js', '.vue', '.json'], 27 | alias: { 28 | 'vue$': 'vue/dist/vue.esm.js', 29 | '@': resolve('src'), 30 | } 31 | }, 32 | module: { 33 | rules: [ 34 | { 35 | test: /\.sass$/, 36 | loaders: ['style', 'css', 'sass'] 37 | }, 38 | { 39 | test: /\.vue$/, 40 | loader: 'vue-loader', 41 | options: vueLoaderConfig 42 | }, 43 | { 44 | test: /\.js$/, 45 | loader: 'babel-loader', 46 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] 47 | }, 48 | { 49 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 50 | loader: 'url-loader', 51 | options: { 52 | limit: 80000, 53 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 54 | } 55 | }, 56 | { 57 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 58 | loader: 'url-loader', 59 | options: { 60 | limit: 80000, 61 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 62 | } 63 | }, 64 | { 65 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 66 | loader: 'url-loader', 67 | options: { 68 | limit: 80000, 69 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 70 | } 71 | }, 72 | // { 73 | // test: /node_modules[\\\/]vis[\\\/].*\.js$/, 74 | // loader: 'babel-loader', 75 | // query: { 76 | // cacheDirectory: true, 77 | // presets: [ "babel-preset-es2015" ].map(require.resolve), 78 | // plugins: [ 79 | // "transform-es3-property-literals", // #2452 80 | // "transform-es3-member-expression-literals", // #2566 81 | // "transform-runtime" // #2566 82 | // ] 83 | // } 84 | // } 85 | ] 86 | }, 87 | node: { 88 | // prevent webpack from injecting useless setImmediate polyfill because Vue 89 | // source contains it (although only uses it if it's native). 90 | setImmediate: false, 91 | // prevent webpack from injecting mocks to Node native modules 92 | // that does not make sense for the client 93 | dgram: 'empty', 94 | fs: 'empty', 95 | net: 'empty', 96 | tls: 'empty', 97 | child_process: 'empty' 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/StudentController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.util.ApiResult; 4 | import com.example.onlineexam.pojo.Student; 5 | import com.example.onlineexam.service.StudentService; 6 | import com.example.onlineexam.util.ApiResultHandler; 7 | import com.example.onlineexam.util.PageBean; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import javax.servlet.http.HttpServletRequest; 12 | 13 | @RestController 14 | public class StudentController { 15 | @Autowired 16 | private StudentService studentService; 17 | @GetMapping("/students/{page}/{size}") 18 | public ApiResult students(@PathVariable("page") Integer page,@PathVariable("size") Integer size){ 19 | PageBean studentPageInfo = studentService.selectStudentByPage(page, size); 20 | return ApiResultHandler.buildApiResult(200, "所有学生", studentPageInfo); 21 | } 22 | @GetMapping("/student/{id}") 23 | public ApiResult student(@PathVariable Integer id){ 24 | Student student = studentService.selectStudentById(id); 25 | return ApiResultHandler.buildApiResult(200, "查找学生", student); 26 | } 27 | @PutMapping("/student") 28 | public ApiResult updaetStudent(@RequestBody Student student){ 29 | Integer integer = studentService.updateStudent(student); 30 | if(integer==1){ 31 | return ApiResultHandler.buildApiResult(200, "更新成功", integer); 32 | } 33 | else { 34 | return ApiResultHandler.buildApiResult(400, "更新失败", integer); 35 | } 36 | } 37 | @PostMapping("/student") 38 | public ApiResult addStudent(@RequestBody Student student){ 39 | Integer integer = studentService.addStudent(student); 40 | if(integer==1){ 41 | return ApiResultHandler.buildApiResult(200, "添加成功", integer); 42 | } 43 | else { 44 | return ApiResultHandler.buildApiResult(400, "添加失败", integer); 45 | } 46 | } 47 | @DeleteMapping("/student/{id}") 48 | public ApiResult deleteStudent(@PathVariable("id") Integer id){ 49 | Integer integer = studentService.deleteStudent(id); 50 | if(integer==1){ 51 | return ApiResultHandler.buildApiResult(200, "删除成功", integer); 52 | } 53 | else { 54 | return ApiResultHandler.buildApiResult(400, "删除失败", integer); 55 | } 56 | } 57 | @PutMapping("studentPWD") 58 | public ApiResult updateStudentPwd(@RequestBody Student student){ 59 | System.out.println("student...."); 60 | Integer integer = studentService.updateStudentPwd(student); 61 | if(integer==1){ 62 | return ApiResultHandler.buildApiResult(200, "修改密码成功", integer); 63 | } 64 | else { 65 | return ApiResultHandler.buildApiResult(400, "修改密码失败", integer); 66 | } 67 | } 68 | @PostMapping("/studentExit") 69 | public ApiResult exit(HttpServletRequest request) { 70 | request.getSession().removeAttribute("student"); 71 | return ApiResultHandler.buildApiResult(200,"退出成功",null); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/AnswerController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.pojo.Answer; 4 | import com.example.onlineexam.pojo.FillQuestion; 5 | import com.example.onlineexam.pojo.JudgeQuestion; 6 | import com.example.onlineexam.pojo.MultiQuestion; 7 | import com.example.onlineexam.service.FillQuestionService; 8 | import com.example.onlineexam.service.JudgeQuestionService; 9 | import com.example.onlineexam.service.MultiQuestionService; 10 | import com.example.onlineexam.util.ApiResult; 11 | import com.example.onlineexam.service.AnswerService; 12 | import com.example.onlineexam.util.ApiResultHandler; 13 | import com.example.onlineexam.util.PageBean; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.web.bind.annotation.*; 16 | 17 | @RestController 18 | public class AnswerController { 19 | @Autowired 20 | private AnswerService answerService; 21 | @Autowired 22 | private MultiQuestionService multiQuestionService; 23 | @Autowired 24 | private FillQuestionService fillQuestionService; 25 | @Autowired 26 | private JudgeQuestionService judgeQuestionService; 27 | @GetMapping("/answers/{page}/{size}") 28 | public ApiResult answers(@PathVariable("page") Integer page,@PathVariable("size") Integer size){ 29 | PageBean answerPageInfo = answerService.selectAnswerByPage(page, size); 30 | return ApiResultHandler.buildApiResult(200, "所有数据", answerPageInfo); 31 | } 32 | @GetMapping("question/{questionId}/{type}") 33 | public ApiResult selectQuestion(@PathVariable("questionId") Integer questionId,@PathVariable("type") String type){ 34 | return answerService.selectQuestion(questionId,type); 35 | } 36 | @PutMapping("questionMulti") 37 | public ApiResult updateQuestionMulti(@RequestBody MultiQuestion multiQuestion){ 38 | int i = multiQuestionService.updateQuestion(multiQuestion); 39 | if(i==1){ 40 | return ApiResultHandler.buildApiResult(200, "更新选择题成功", i); 41 | } 42 | else { 43 | return ApiResultHandler.buildApiResult(400, "更新选择题成功", i); 44 | } 45 | } 46 | @PutMapping("questionFill") 47 | public ApiResult updateQuestionFill(@RequestBody FillQuestion fillQuestion){ 48 | int i = fillQuestionService.updateQuestion(fillQuestion); 49 | if(i==1){ 50 | return ApiResultHandler.buildApiResult(200, "更新填空题成功", i); 51 | } 52 | else { 53 | return ApiResultHandler.buildApiResult(400, "更新填空题成功", i); 54 | } 55 | } 56 | @PutMapping("questionJudge") 57 | public ApiResult updateQuestionJudge(@RequestBody JudgeQuestion judgeQuestion){ 58 | int i = judgeQuestionService.updateQuestion(judgeQuestion); 59 | if(i==1){ 60 | return ApiResultHandler.buildApiResult(200, "更新判断题成功", i); 61 | } 62 | else { 63 | return ApiResultHandler.buildApiResult(400, "更新判断题成功", i); 64 | } 65 | } 66 | @DeleteMapping("question/{questionId}/{type}") 67 | public ApiResult deleteQuestion(@PathVariable("questionId") Integer questionId,@PathVariable("type") String type) { 68 | return answerService.deleteQuestion(questionId, type); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /前端/exam/src/components/student/manager.vue: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 90 | 91 | -------------------------------------------------------------------------------- /前端/exam/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const webpack = require('webpack') 4 | const config = require('../config') 5 | const merge = require('webpack-merge') 6 | const path = require('path') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 11 | const portfinder = require('portfinder') 12 | 13 | const HOST = process.env.HOST 14 | const PORT = process.env.PORT && Number(process.env.PORT) 15 | 16 | const devWebpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) 19 | }, 20 | // cheap-module-eval-source-map is faster for development 21 | devtool: config.dev.devtool, 22 | 23 | // these devServer options should be customized in /config/index.js 24 | devServer: { 25 | clientLogLevel: 'warning', 26 | historyApiFallback: { 27 | rewrites: [ 28 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, 29 | ], 30 | }, 31 | hot: true, 32 | contentBase: false, // since we use CopyWebpackPlugin. 33 | compress: true, 34 | host: HOST || config.dev.host, 35 | port: PORT || config.dev.port, 36 | open: config.dev.autoOpenBrowser, 37 | overlay: config.dev.errorOverlay 38 | ? { warnings: false, errors: true } 39 | : false, 40 | publicPath: config.dev.assetsPublicPath, 41 | proxy: config.dev.proxyTable, 42 | quiet: true, // necessary for FriendlyErrorsPlugin 43 | watchOptions: { 44 | poll: config.dev.poll, 45 | } 46 | }, 47 | plugins: [ 48 | new webpack.DefinePlugin({ 49 | 'process.env': require('../config/dev.env') 50 | }), 51 | new webpack.HotModuleReplacementPlugin(), 52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. 53 | new webpack.NoEmitOnErrorsPlugin(), 54 | // https://github.com/ampedandwired/html-webpack-plugin 55 | new HtmlWebpackPlugin({ 56 | filename: 'index.html', 57 | template: 'index.html', 58 | inject: true 59 | }), 60 | // copy custom static assets 61 | new CopyWebpackPlugin([ 62 | { 63 | from: path.resolve(__dirname, '../static'), 64 | to: config.dev.assetsSubDirectory, 65 | ignore: ['.*'] 66 | } 67 | ]) 68 | ] 69 | }) 70 | 71 | module.exports = new Promise((resolve, reject) => { 72 | portfinder.basePort = process.env.PORT || config.dev.port 73 | portfinder.getPort((err, port) => { 74 | if (err) { 75 | reject(err) 76 | } else { 77 | // publish the new Port, necessary for e2e tests 78 | process.env.PORT = port 79 | // add port to devServer config 80 | devWebpackConfig.devServer.port = port 81 | 82 | // Add FriendlyErrorsPlugin 83 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 84 | compilationSuccessInfo: { 85 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 86 | }, 87 | onErrors: config.dev.notifyOnErrors 88 | ? utils.createNotifierCallback() 89 | : undefined 90 | })) 91 | 92 | resolve(devWebpackConfig) 93 | } 94 | }) 95 | }) 96 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/TeacherController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.util.ApiResult; 4 | import com.example.onlineexam.pojo.Teacher; 5 | import com.example.onlineexam.service.TeacherService; 6 | import com.example.onlineexam.util.ApiResultHandler; 7 | import com.example.onlineexam.util.PageBean; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import javax.servlet.http.HttpServletRequest; 12 | 13 | @RestController 14 | public class TeacherController { 15 | @Autowired 16 | private TeacherService teacherService; 17 | @GetMapping("/teachers/{page}/{size}") 18 | public ApiResult teachers(@PathVariable("page") Integer page,@PathVariable("size") Integer size){ 19 | PageBean teacherPageInfo = teacherService.selectTeacherByPage(page, size); 20 | return ApiResultHandler.buildApiResult(200, "查询教师", teacherPageInfo); 21 | } 22 | @PostMapping("/teacher") 23 | public ApiResult addTeacher(@RequestBody Teacher teacher){ 24 | Integer integer = teacherService.addTeacher(teacher); 25 | if(integer==1){ 26 | return ApiResultHandler.buildApiResult(200, "增加成功", integer); 27 | } 28 | else { 29 | return ApiResultHandler.buildApiResult(400, "增加失败", integer); 30 | } 31 | } 32 | @GetMapping("/teacher/{id}") 33 | public ApiResult teacher(@PathVariable("id") Integer id){ 34 | Teacher teacher = teacherService.selectTeacherById(id); 35 | return ApiResultHandler.buildApiResult(200, "查询教师", teacher); 36 | } 37 | @PutMapping("/teacher") 38 | public ApiResult updateTeacher(@RequestBody Teacher teacher){ 39 | Integer integer = teacherService.updateTeacher(teacher); 40 | if (integer==1){ 41 | return ApiResultHandler.buildApiResult(200, "更新成功", integer); 42 | } 43 | else { 44 | return ApiResultHandler.buildApiResult(400, "更新失败", integer); 45 | } 46 | } 47 | @DeleteMapping("/teacher/{id}") 48 | public ApiResult deleteTeacher(@PathVariable("id") Integer id){ 49 | Integer integer = teacherService.deleteTeacher(id); 50 | if(integer==1){ 51 | return ApiResultHandler.buildApiResult(200, "删除成功", integer); 52 | } 53 | else { 54 | return ApiResultHandler.buildApiResult(400, "删除失败", integer); 55 | } 56 | } 57 | 58 | @PostMapping("/admin_teacherExit") 59 | public ApiResult exit(HttpServletRequest request) { 60 | System.out.println("执行了。。。。。"); 61 | String admin = (String) request.getSession().getAttribute("admin"); 62 | String teacher = (String) request.getSession().getAttribute("teacher"); 63 | if(admin!=null) { 64 | request.getSession().removeAttribute("admin"); 65 | } 66 | if(teacher!=null) { 67 | request.getSession().removeAttribute("teacher"); 68 | } 69 | return ApiResultHandler.buildApiResult(200,"退出成功",null); 70 | } 71 | 72 | /** 73 | * 修改密码 74 | * @param teacher 75 | * @return 76 | */ 77 | @PutMapping("/teacherPWD") 78 | public ApiResult updatePwd(@RequestBody Teacher teacher) { 79 | System.out.println("teacher..."); 80 | teacherService.updatePwdTeacher(teacher); 81 | return ApiResultHandler.buildApiResult(200,"密码更新成功",null); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/controller/ExamManageController.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.controller; 2 | 3 | import com.example.onlineexam.util.ApiResult; 4 | import com.example.onlineexam.pojo.ExamManage; 5 | import com.example.onlineexam.service.ExamManageService; 6 | import com.example.onlineexam.util.ApiResultHandler; 7 | import com.example.onlineexam.util.PageBean; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.util.List; 12 | 13 | @RestController 14 | public class ExamManageController { 15 | @Autowired 16 | private ExamManageService examManageService; 17 | @GetMapping("/exams/{page}/{size}") 18 | public ApiResult exams(@PathVariable("page") Integer page, @PathVariable("size") Integer size){ 19 | PageBean all = examManageService.selectExamManageByPage(page, size); 20 | return ApiResultHandler.buildApiResult(200, "成功", all); 21 | } 22 | @GetMapping("/partexams/{page}/{size}") 23 | public ApiResult partexams(@PathVariable("page") Integer page, @PathVariable("size") Integer size){ 24 | PageBean all = examManageService.selectPartExamManageByPage(page, size); 25 | return ApiResultHandler.buildApiResult(200, "成功", all); 26 | } 27 | @GetMapping("/examManagePaperId") 28 | public ApiResult examManagePaperId() { 29 | Integer integer = examManageService.examManagePaperId(); 30 | return ApiResultHandler.buildApiResult(200, "成功", integer); 31 | } 32 | @PostMapping("/exam") 33 | public ApiResult exam(@RequestBody ExamManage examManage){ 34 | Integer res = examManageService.addExam(examManage); 35 | if(res==1) { 36 | return ApiResultHandler.buildApiResult(200, "增加成功", res); 37 | } 38 | else { 39 | return ApiResultHandler.buildApiResult(400, "增加失败", res); 40 | } 41 | } 42 | @GetMapping("/exam/{id}") 43 | public ApiResult getexam(@PathVariable("id") Integer id){ 44 | ExamManage examManage = examManageService.selectExamManageById(id); 45 | return ApiResultHandler.buildApiResult(200, "查询试卷", examManage); 46 | } 47 | @PutMapping("/exam") 48 | public ApiResult updateExam(@RequestBody ExamManage examManage){ 49 | Integer integer = examManageService.updateExam(examManage); 50 | if(integer==1){ 51 | return ApiResultHandler.buildApiResult(200, "更新成功", integer); 52 | } 53 | else { 54 | return ApiResultHandler.buildApiResult(400, "更新失败", integer); 55 | } 56 | } 57 | @DeleteMapping("/exam/{id}") 58 | public ApiResult deleteExam(@PathVariable("id") Integer id){ 59 | Integer integer = examManageService.deleteExam(id); 60 | if(integer==1){ 61 | return ApiResultHandler.buildApiResult(200, "删除成功", integer); 62 | } 63 | else { 64 | return ApiResultHandler.buildApiResult(400, "删除失败", integer); 65 | } 66 | } 67 | @GetMapping("exams") 68 | public ApiResult findExamByKey(){ 69 | List examManages = examManageService.selectAll(); 70 | return ApiResultHandler.buildApiResult(200, "查询所有", examManages); 71 | } 72 | @GetMapping("partexams") 73 | public ApiResult findPartExamByKey(){ 74 | List examManages = examManageService.selectPartExamManage(); 75 | return ApiResultHandler.buildApiResult(200, "查询所有", examManages); 76 | } 77 | } -------------------------------------------------------------------------------- /前端/exam/src/components/common/mainLeft.vue: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 82 | 83 | 118 | -------------------------------------------------------------------------------- /后端/online-exam/src/main/java/com/example/onlineexam/service/impl/AnswerServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.onlineexam.service.impl; 2 | 3 | import com.example.onlineexam.mapper.AnswerMapper; 4 | import com.example.onlineexam.mapper.FillQuestionMapper; 5 | import com.example.onlineexam.mapper.JudgeQuestionMapper; 6 | import com.example.onlineexam.mapper.MultiQuestionMapper; 7 | import com.example.onlineexam.pojo.Answer; 8 | import com.example.onlineexam.pojo.FillQuestion; 9 | import com.example.onlineexam.pojo.JudgeQuestion; 10 | import com.example.onlineexam.pojo.MultiQuestion; 11 | import com.example.onlineexam.service.AnswerService; 12 | import com.example.onlineexam.util.ApiResult; 13 | import com.example.onlineexam.util.ApiResultHandler; 14 | import com.example.onlineexam.util.PageBean; 15 | import com.github.pagehelper.PageHelper; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.stereotype.Service; 18 | 19 | import java.util.List; 20 | 21 | @Service 22 | public class AnswerServiceImpl implements AnswerService { 23 | @Autowired 24 | private AnswerMapper answerMapper; 25 | @Autowired 26 | private MultiQuestionMapper multiQuestionMapper; 27 | @Autowired 28 | private FillQuestionMapper fillQuestionMapper; 29 | @Autowired 30 | private JudgeQuestionMapper judgeQuestionMapper; 31 | @Override 32 | public PageBean selectAnswerByPage(Integer page, Integer size) { 33 | PageHelper.startPage(page, size); 34 | List answers = answerMapper.selectAllAnswer(); 35 | PageBean answerPageInfo = new PageBean<>(answers,size); 36 | return answerPageInfo; 37 | } 38 | 39 | @Override 40 | public ApiResult selectQuestion(Integer questionId, String type) { 41 | if("选择题".equals(type)){ 42 | MultiQuestion multiQuestion = multiQuestionMapper.selectById(questionId); 43 | return ApiResultHandler.buildApiResult(200, "查询选择题", multiQuestion); 44 | } 45 | if("填空题".equals(type)){ 46 | FillQuestion fillQuestion = fillQuestionMapper.selectById(questionId); 47 | return ApiResultHandler.buildApiResult(200, "查询填空题", fillQuestion); 48 | } 49 | if("判断题".equals(type)){ 50 | JudgeQuestion judgeQuestion = judgeQuestionMapper.selectById(questionId); 51 | return ApiResultHandler.buildApiResult(200, "查询判断题", judgeQuestion); 52 | } 53 | return ApiResultHandler.buildApiResult(400,"未知题型",null); 54 | } 55 | 56 | @Override 57 | public ApiResult deleteQuestion(Integer questionId, String type) { 58 | if ("选择题".equals(type)){ 59 | int i = multiQuestionMapper.deleteById(questionId); 60 | if (i==1){ 61 | return ApiResultHandler.buildApiResult(200, "删除成功", i); 62 | } 63 | else { 64 | return ApiResultHandler.buildApiResult(400, "删除失败", i); 65 | } 66 | } 67 | if ("填空题".equals(type)){ 68 | int i = fillQuestionMapper.deleteById(questionId); 69 | if (i==1){ 70 | return ApiResultHandler.buildApiResult(200, "删除成功", i); 71 | } 72 | else { 73 | return ApiResultHandler.buildApiResult(400, "删除失败", i); 74 | } 75 | } 76 | if ("判断题".equals(type)){ 77 | int i = judgeQuestionMapper.deleteById(questionId); 78 | if (i==1){ 79 | return ApiResultHandler.buildApiResult(200, "删除成功", i); 80 | } 81 | else { 82 | return ApiResultHandler.buildApiResult(400, "删除失败", i); 83 | } 84 | } 85 | return ApiResultHandler.buildApiResult(400,"未知题型",null); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /前端/exam/src/components/teacher/addExam.vue: -------------------------------------------------------------------------------- 1 | 2 | 44 | 45 | 104 | 110 | 111 | --------------------------------------------------------------------------------