package examination.controller;
import examination.entity.ChoiceQuestion;
import examination.entity.JudgeQuestion;
import examination.entity.Paper;
import examination.entity.Question.Choicedba;
import examination.entity.Question.Judgedba;
import examination.entity.SubjectQuestion;
import examination.service.ChartService;
import examination.entity.Question.Subdba;
import examination.service.ExamService;
import examination.service.ExerciseService;
import examination.service.PaperService;
import examination.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/teacher")
public class TeacherController {
final static String path = "teacher/";
@Autowired
TeacherService teacherService;
@Autowired
PaperService paperService;
@Autowired
ChartService chartService;
@Autowired
ExerciseService exerciseService;
@Autowired
ExamService examService;
@RequestMapping(value = "")
String index(Model model, HttpSession httpSession) {
return "redirect:" + path + "teacherpage";
}
@RequestMapping(value = "teacherpage")
String adminpage(Model model, HttpSession httpSession) {
model.addAttribute("name", httpSession.getAttribute("name"));
model.addAttribute("permission", httpSession.getAttribute("permission"));
return path + "teacherpage";
}
@RequestMapping(value = "question_list")
String questionList(Model model, HttpServletRequest request) {
model.addAttribute("page", paperService.getPage(request.getParameter("currentPage"),"choice"));
model.addAttribute("choiceQuestuon", paperService.getChoiceQuestion());
return path + "question_list";
}
@RequestMapping(value = "truefalse_list")
String truefalseList(Model model, HttpServletRequest request) {
model.addAttribute("page", paperService.getPage(request.getParameter("currentPage"),"judge"));
model.addAttribute("judgeQuestuon", paperService.getJudgeQuestion());
return path + "truefalse_list";
}
@RequestMapping(value = "sub_list")
String subList(Model model, HttpServletRequest request) {
model.addAttribute("page", paperService.getPage(request.getParameter("currentPage"),"sub"));
model.addAttribute("subjectQuestuon", paperService.getSubjectQuestion());
return path + "sub_list";
}
@RequestMapping(value = "get_paper")
String getPaper(Model model) {
model.addAttribute("choiceQuestuon", paperService.getAllChoiceQuestion());
return path + "choice_combine";
}
@RequestMapping(value = "/{type}/combine")
public String question(@PathVariable String type, HttpServletRequest request,Model model) {
HttpSession session = request.getSession();
if ("choice".equals(type)) {
session.setAttribute("choi", request.getParameter("choice"));
model.addAttribute("judgeQuestuon", paperService.getAllJudgeQuestion());
return path + "judge_combine";
} else if ("judge".equals(type)) {
session.setAttribute("judg", request.getParameter("judge"));
model.addAttribute("subjectQuestuon", paperService.getAllSubjectQuestion());
return path + "sub_combine";
} else if ("sub".equals(type)) {
session.setAttribute("sub", request.getParameter("sub"));
return path + "other_config";
}
return "error";
}
@RequestMapping(value = "{type}/delete")
@ResponseBody()
boolean deleteQuestion(@PathVariable String type, long id) {
if ("choice".equals(type)) {
return teacherService.deleteChoiceQuestion(id) != 0;
} else if ("judge".equals(type)) {
return teacherService.deleteJudgeQuestion(id) != 0;
} else if ("sub".equals(type)) {
return teacherService.deleteSubjectQuestion(id) != 0;
}
return false;
}
@RequestMapping(value = "{type}/delete_batch")
@ResponseBody()
boolean deleteQuestionBatch(@PathVariable String type, @RequestParam("list[]") List<Long> list) {
if ("choice".equals(type)) {
return teacherService.deleteChoiceQuestionBatch(list) != 0;
} else if ("judge".equals(type)) {
return teacherService.deleteJudgeQuestionBatch(list) != 0;
} else if ("sub".equals(type)) {
return teacherService.deleteSubjectQuestionBatch(list) != 0;
}
return false;
}
//update之所以不按照上面套路写作{type}/update,是因为springmvc需要把传入的参数映射为
// ChoiceQuestion等对象,分开写才能对于不同的对象映射。
@RequestMapping(value = "choice/update")
@ResponseBody()
boolean updateChoiceQuestion(ChoiceQuestion choiceQuestion) {
return teacherService.updateChoiceQuestion(choiceQuestion) != 0;
}
@RequestMapping(value = "judge/update")
@ResponseBody()
boolean updateJudgeQuestion(JudgeQuestion judgeQuestion) {
return teacherService.updateJudgeQuestion(judgeQuestion) != 0;
}
@RequestMapping(value = "sub/update")
@ResponseBody()
boolean updateSubjectQuestion(SubjectQuestion subjectQuestion) {
return teacherService.updateSubjectQuestion(subjectQuestion) != 0;
}
@RequestMapping(value = "paper_finish")
@ResponseBody
boolean finishPaper(HttpServletRequest request) {
HttpSession session = request.getSession();
String name = request.getParameter("name");
String begintime = request.getParameter("begintime");
String finishtime = request.getParameter("finishtime");
String choi = (String) session.getAttribute("choi");
String judg = (String) session.getAttribute("judg");
String sub = (String) session.getAttribute("sub");
long tid = (long) session.getAttribute("userid");
String classid = request.getParameter("classid");
String choiscore="";
for (int i = 0; i < choi.split(",").length; i++) {
choiscore+="4,";
}
choiscore=choiscore.substring(0,choiscore.length()-1);
String judgscore="";
for (int i = 0; i < judg.split(",").length; i++) {
judgscore +="4,";
}
judgscore=judgscore.substring(0,judgscore.length()-1);
String subscore="";
for (int i = 0; i < sub.split(",").length; i++) {
subscore+="4,";
}
subscore=subscore.substring(0,subscore.length()-1);
System.out.println("name:" + name);
System.out.println("begintime:" + begintime);
System.out.println("finishtime:" + finishtime);
System.out.println("choi:" + choi);
System.out.println("judg:" + judg);
System.out.println("sub:" + sub);
System.out.println("tid:" + tid);
System.out.println("classid:" + classid);
return paperService.addPaper(new Paper(name, begintime, finishtime, choi,
judg, sub,choiscore,judgscore,subscore, tid, classid)) != 0;
}
@RequestMapping(value = "student_grade")
String student_grade(Model model, HttpSession session) {
long tid = (long) session.getAttribute("userid");
model.addAttribute("paper", teacherService.listExamById(tid));
return path + "student_grade";
}
@RequestMapping(value = "student_grade_list")
String studentGradeList(Model model, HttpSessio
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】: 包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。 包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。 【项目质量】: 所有源码都经过严格测试,可以直接运行。 功能在确认正常工作后才上传。 【适用人群】: 适用于希望学习不同技术领域的小白或进阶学习者。 可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。 【附加价值】: 项目具有较高的学习借鉴价值,也可直接拿来修改复刻。 对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。 【沟通交流】: 有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
收起资源包目录
数据库课程设计-考试系统.zip (242个子文件)
bootstrap.css 124KB
bootstrap.min.css 104KB
bootstrap-responsive.css 22KB
all.css 17KB
bootstrap-responsive.min.css 16KB
aaa.css 5KB
bbb.css 3KB
1.css 21B
btn11.gif 2KB
btn.gif 2KB
btn10.gif 2KB
page_be.gif 1KB
btn07g.gif 986B
btn01.gif 986B
btn06.gif 890B
btn05.gif 870B
btn02.gif 850B
page.gif 450B
btn07.gif 397B
btn04.gif 380B
btn03.gif 317B
.gitignore 123B
question_list.html 11KB
truefalse_list.html 10KB
sub_list.html 10KB
student_test_ing.html 9KB
student_manage.html 8KB
teacher_manage.html 7KB
add_student.html 7KB
see_test_ing.html 6KB
pigai_test_ing.html 6KB
add_teacher.html 5KB
student_status.html 5KB
choice_combine.html 5KB
student_exercise_choice.html 5KB
sub_combine.html 4KB
judge_combine.html 4KB
student_grade.html 4KB
teacher_info.html 4KB
student_info.html 4KB
student_evaluating_list_select.html 4KB
student_evaluating_list_insert.html 4KB
student_evaluating_list_delete.html 4KB
student_evaluating_list_update.html 4KB
admin_info.html 4KB
_student_exercise_choice.html 4KB
student_grade.html 4KB
student_exercise_truefalse.html 4KB
student_test.html 4KB
teacher_test_list.html 4KB
studentpage.html 4KB
login.html 4KB
_student_exercise.html 4KB
other_config.html 4KB
student_exercise_sub.html 3KB
teacherpage.html 3KB
student_evaluating_question.html 3KB
_login.html 3KB
adminpage.html 3KB
student_grade_list.html 3KB
student_chart.html 3KB
student_chart.html 3KB
student_exercise.html 3KB
change_info.html 2KB
_student_exercise_truefalse.html 2KB
_student_exercise_sub.html 2KB
logout.html 1KB
_adminpage.html 371B
_studentpage.html 368B
_teacherpage.html 368B
_index.html 359B
wrongpassword.html 304B
notpermission.html 280B
session.html 279B
_logout.html 268B
notlogin.html 268B
error.html 264B
ExaminationSystem.iml 9KB
TeacherController.java 12KB
CompareSQLService.java 9KB
StudentController.java 8KB
AdminController.java 5KB
TeacherService.java 5KB
AdminService.java 4KB
ExamService.java 4KB
Paper.java 3KB
LoginController.java 3KB
ChartService.java 3KB
ChoiceQuestion.java 2KB
PaperService.java 2KB
LoginService.java 2KB
CaptchaController.java 2KB
EvaluatingService.java 2KB
Choicedba.java 2KB
Student.java 2KB
CaptchaInterceptor.java 2KB
ExerciseService.java 1KB
KaptchaConfig.java 1KB
Teacher.java 1KB
JudgeQuestion.java 1KB
共 242 条
- 1
- 2
- 3
资源评论
妄北y
- 粉丝: 1w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功