package com.sk.controller.teacher;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.sk.commons.CopyEntityToDto;
import com.sk.commons.ExamConstant;
import com.sk.dto.QuestionsDto;
import com.sk.dto.SelectedDto;
import com.sk.service.DictService;
import com.sk.service.QuestionService;
import com.sk.service.SubjectService;
@RequestMapping("/teacher")
@Controller
public class TeacherQuestionController {
@Autowired
private QuestionService questionService;
@Autowired
private DictService dictService;
@Autowired
private CopyEntityToDto copyEntityToDto;
@Autowired
private SubjectService subjectService;
/**
* 通过Id修改试题相关
* @param httpServletRequest
* @return
*/
@ResponseBody
@RequestMapping("/upQuestionById")
public String updateQuestion(HttpServletRequest request){
String content = request.getParameter("content");
String[] id = request.getParameter("id").toString().split(";");
QuestionsDto dto = new QuestionsDto();
if(questionService.getQuestionByContentAndId(content,Integer.parseInt(id[0]))!=null){
return "2";
}else{
String qtypeid = request.getParameter("qtypeid");
String result = request.getParameter("result");
String sid = request.getParameter("sid");
dto.setContent(content);
dto.setQtypeid(Integer.parseInt(qtypeid));
dto.setResult(Integer.parseInt(result));
dto.setSubjectid(Integer.parseInt(sid));
dto.setId(Integer.parseInt(id[0]));
dto.setVersion(Integer.parseInt(id[1]));
List<SelectedDto> sList = null;
if(dictService.getDictByTypeAndCode(ExamConstant.QUES_TYPE, ExamConstant.QUES_SELECT).getId().equals(Integer.parseInt(qtypeid))){
sList = new ArrayList<>();
String[] Aid = request.getParameter("Aid").toString().split(";");
String[] Bid = request.getParameter("Bid").toString().split(";");
String[] Cid = request.getParameter("Cid").toString().split(";");
String[] Did = request.getParameter("Did").toString().split(";");
SelectedDto A =
new SelectedDto(Integer.parseInt(Aid[0]),Integer.parseInt(id[0]),dictService.getDictByTypeAndCode(ExamConstant.QUES_SELECT_TYPE, ExamConstant.QUES_A).getId(), request.getParameter("A"), Integer.parseInt(Aid[1]));
SelectedDto B =
new SelectedDto(Integer.parseInt(Bid[0]),Integer.parseInt(id[0]),dictService.getDictByTypeAndCode(ExamConstant.QUES_SELECT_TYPE, ExamConstant.QUES_B).getId(), request.getParameter("B"), Integer.parseInt(Bid[1]));
SelectedDto C =
new SelectedDto(Integer.parseInt(Cid[0]),Integer.parseInt(id[0]),dictService.getDictByTypeAndCode(ExamConstant.QUES_SELECT_TYPE, ExamConstant.QUES_C).getId(), request.getParameter("C"), Integer.parseInt(Cid[1]));
SelectedDto D =
new SelectedDto(Integer.parseInt(Did[0]),Integer.parseInt(id[0]),dictService.getDictByTypeAndCode(ExamConstant.QUES_SELECT_TYPE, ExamConstant.QUES_D).getId(), request.getParameter("D"), Integer.parseInt(Did[1]));
sList.add(A);
sList.add(B);
sList.add(C);
sList.add(D);
}
dto.setSelecteds(sList);
if(questionService.updateQuestionById(dto)){
return "0";
}else{
return "1";
}
}
}
/**
* 查看具体试题
* @param request
* @return
*/
@RequestMapping("/getQuestionById")
public String getQuestionById(HttpServletRequest request){
String id = request.getParameter("id");
request.setAttribute("subList", subjectService.getAllSubjects());
request.setAttribute("qDto",copyEntityToDto.copyQuesEntityToDto(questionService.getQuestionById(Integer.parseInt(id))));
return "_teacher/questionUpdate";
}
/**
* 删除试题并删除其关联选项
* @param request
* @return
*/
@ResponseBody
@RequestMapping("/deleteQuestion")
public String delQuestion(HttpServletRequest request){
String qid = request.getParameter("qid");
String tid = request.getParameter("tid");
if(qid==null || "".equals(qid)){
return "1";
}else{
if(questionService.delQuestionById(Integer.parseInt(qid),Integer.parseInt(tid))){
return "0";
}else{
return "1";
}
}
}
/**
* 添加试题
* @param request
* @return
*/
@ResponseBody
@RequestMapping("/doAddQuestion")
public String addQuestion(HttpServletRequest request){
String content = request.getParameter("content");
QuestionsDto dto = new QuestionsDto();
if(questionService.getQuestionByContent(content)!=null){
return "2";
}else{
String qtypeid = request.getParameter("qtypeid");
String result = request.getParameter("result");
String sid = request.getParameter("sid");
dto.setContent(content);
dto.setQtypeid(Integer.parseInt(qtypeid));
dto.setResult(Integer.parseInt(result));
dto.setSubjectid(Integer.parseInt(sid));
dto.setVersion(0);
List<SelectedDto> sList = null;
if(dictService.getDictByTypeAndCode(ExamConstant.QUES_TYPE, ExamConstant.QUES_SELECT).getId().equals(Integer.parseInt(qtypeid))){
sList = new ArrayList<>();
SelectedDto A =
new SelectedDto(dictService.getDictByTypeAndCode(ExamConstant.QUES_SELECT_TYPE, ExamConstant.QUES_A).getId(), request.getParameter("A"), 0);
SelectedDto B =
new SelectedDto(dictService.getDictByTypeAndCode(ExamConstant.QUES_SELECT_TYPE, ExamConstant.QUES_B).getId(), request.getParameter("B"), 0);
SelectedDto C =
new SelectedDto(dictService.getDictByTypeAndCode(ExamConstant.QUES_SELECT_TYPE, ExamConstant.QUES_C).getId(), request.getParameter("C"), 0);
SelectedDto D =
new SelectedDto(dictService.getDictByTypeAndCode(ExamConstant.QUES_SELECT_TYPE, ExamConstant.QUES_D).getId(), request.getParameter("D"), 0);
sList.add(A);
sList.add(B);
sList.add(C);
sList.add(D);
}
dto.setSelecteds(sList);
if(questionService.addQuestion(dto)){
return "0";
}else{
return "1";
}
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于SSM框架在线考试系统设计文档
共540个文件
png:82个
class:74个
java:74个
5星 · 超过95%的资源 需积分: 49 134 下载量 71 浏览量
2018-08-06
13:11:31
上传
评论 18
收藏 10.6MB ZIP 举报
温馨提示
使用Maven 分模块构建基于SSM框架的在线考试系统,带sql文件。提供用户管理功能。寻求详细设计文档留言联系我。
资源推荐
资源详情
资源评论
收起资源包目录
基于SSM框架在线考试系统设计文档 (540个子文件)
TeacherExamController.class 7KB
ExamController.class 7KB
CopyEntityToDto.class 7KB
TeacherQuestionController.class 6KB
QuestionController.class 6KB
StudentController.class 6KB
QuestionServiceImpl.class 5KB
AdminController.class 5KB
LoginController.class 5KB
StuExamController.class 5KB
StuExamServiceImpl.class 5KB
ScoreServiceImpl.class 4KB
CodeController.class 4KB
TeacherController.class 4KB
StudentServiceImpl.class 4KB
TestController.class 4KB
ExamServiceImpl.class 3KB
UserController.class 3KB
SelectedDto.class 3KB
TeacherSubjectController.class 3KB
SubjectController.class 3KB
ExamDto.class 3KB
QuestionsDto.class 3KB
StuExamDto.class 3KB
StudentDto.class 2KB
UserServiceImpl.class 2KB
TeacherInterceptor.class 2KB
AdminInterceptor.class 2KB
StuInterceptor.class 2KB
UserDto.class 2KB
TeachStudentController.class 2KB
ExamConstant.class 2KB
Selected.class 2KB
ScoreDto.class 2KB
Dict.class 2KB
Loginmsg.class 2KB
DictDto.class 2KB
LoginmsgDto.class 2KB
StuExam.class 2KB
SubjectServiceImpl.class 2KB
SortStuExamUtil.class 2KB
User.class 2KB
Exam.class 2KB
Questions.class 2KB
TeachScoerController.class 2KB
MD5EncodingUtil.class 2KB
Subject.class 1KB
StuExamQuesResultDto.class 1KB
StuExamQuesResult.class 1KB
SubjectDto.class 1KB
Student.class 1KB
CopyDtoToEntity.class 1KB
ExamQuestionDto.class 1KB
ExamQuestion.class 1KB
StuExamMapper.class 1KB
DictServiceImpl.class 1KB
QuestionsMapper.class 992B
ExamMapper.class 850B
UserMapper.class 830B
QuestionService.class 793B
DictMapper.class 754B
StuExamQuesResultMapper.class 751B
ExamQuestionMapper.class 719B
StuExamService.class 717B
SubjectMapper.class 678B
SelectedMapper.class 675B
ExamService.class 651B
UserService.class 649B
SubjectService.class 505B
StudentMapper.class 492B
ScoreService.class 401B
StudentService.class 394B
LoginmsgMapper.class 391B
DictService.class 354B
.classpath 1KB
.classpath 1KB
.classpath 1KB
.classpath 1KB
.classpath 1KB
.classpath 1KB
org.eclipse.wst.common.component 2KB
org.eclipse.wst.common.component 327B
org.eclipse.wst.common.component 327B
org.eclipse.wst.common.component 326B
org.eclipse.wst.common.component 323B
org.eclipse.wst.common.component 249B
org.eclipse.wst.jsdt.ui.superType.container 49B
bootstrap.css 149KB
bootstrap.css 143KB
bootstrap.min.css 135KB
bootstrap.min.css 125KB
quanju.css 108KB
quanju.css 108KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
_all.css 20KB
_all.css 14KB
_all.css 14KB
jquery.dataTables.min.css 13KB
_all.css 12KB
共 540 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- 一个奶嗝2020-06-09求详细设计文档thftll2020-06-15https://download.csdn.net/download/thftll/12524366
- Jason_cd2019-04-15求需求文档,联系qq1042933512
- 懵懂新少年2019-04-10需详细文档thftll2019-04-11留个联系方式
- 执笔书殇2018-10-11求详细设计文档thftll2019-04-11联系方式
thftll
- 粉丝: 1
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功