Compare commits

...

2 Commits

@ -3,6 +3,9 @@ package lsgwr.exam;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Spring BootSpring Boot
*/
@SpringBootApplication
public class ExamApplication {

@ -1,9 +1,6 @@
/***********************************************************
* @Description :
* @author : 广(Laing Shan Guang)
* @date : 2019-05-28 08:04
* @email : liangshanguang2@gmail.com
***********************************************************/
/**
* @Description : REST,HTTP,,
*/
package lsgwr.exam.controller;
import lsgwr.exam.entity.Exam;
@ -22,11 +19,16 @@ import java.util.List;
@RestController
@Api(tags = "Exam APIs")
//将此控制器中的所有端点映射到/api/exam URL路径
@RequestMapping("/api/exam")
public class ExamController {
@Autowired
@Autowired //注入一个ExamService实例用于处理与考试和问题相关的业务逻辑
private ExamService examService;
/**
* @Description: 使examService.getQuestionAll(),ResultVO,
* @ApiOperationAPI,SwaggerUI
*/
@GetMapping("/question/all")
@ApiOperation("获取所有问题的列表")
ResultVO<List<QuestionVo>> getQuestionAll() {
@ -41,6 +43,10 @@ public class ExamController {
return resultVO;
}
/**
* @Description: QuestionVo使examService.updateQuestion()
* @param questionVo QuestionVo
*/
@PostMapping("/question/update")
@ApiOperation("更新问题")
ResultVO<QuestionVo> questionUpdate(@RequestBody QuestionVo questionVo) {
@ -55,6 +61,13 @@ public class ExamController {
}
}
/**
*
* @Description: QuestionCreateSimplifyVoQuestionCreateVoID使examService.questionCreate()
* @param questionCreateSimplifyVo QuestionCreateSimplifyVo
* @param request HttpServletRequestID
* @return ResultVO<String>
*/
@PostMapping("/question/create")
@ApiOperation("创建问题")
ResultVO<String> questionCreate(@RequestBody QuestionCreateSimplifyVo questionCreateSimplifyVo, HttpServletRequest request) {
@ -74,6 +87,10 @@ public class ExamController {
}
}
/**
* @Description: ,使examService.getSelections()ResultVO
* @return ResultVO<QuestionAllVo>
*/
@GetMapping("/question/selection")
@ApiOperation("获取问题分类的相关选项")
ResultVO<QuestionSelectionVo> getSelections() {
@ -85,6 +102,11 @@ public class ExamController {
}
}
/**
* @Description: 使examService.getQuestionDetail(id),ResultVO,
* @param id id
* @return ResultVO<QuestionDetailVo>
*/
@GetMapping("/question/detail/{id}")
@ApiOperation("根据问题的id获取问题的详细信息")
ResultVO<QuestionDetailVo> getQuestionDetail(@PathVariable String id) {
@ -101,6 +123,10 @@ public class ExamController {
return resultVO;
}
/**
* @Description: 使examService.getExamAll(),ResultVO,
* @return ResultVO<QuestionDetailVo>
*/
@GetMapping("/all")
@ApiOperation("获取全部考试的列表")
ResultVO<List<ExamVo>> getExamAll() {
@ -116,6 +142,10 @@ public class ExamController {
return resultVO;
}
/**
* @Description: 使examService.getExamQuestionTypeList(),ResultVO,
* @return ResultVO<ExamQuestionTypeVo>
*/
@GetMapping("/question/type/list")
@ApiOperation("获取问题列表,按照单选、多选和判断题分类返回")
ResultVO<ExamQuestionTypeVo> getExamQuestionTypeList() {
@ -131,6 +161,12 @@ public class ExamController {
return resultVO;
}
/**
* @Description: 使examService.createExam(),ResultVO,
* @param examCreateVo
* @param request id
* @return ResultVO<Exam>
*/
@PostMapping("/create")
@ApiOperation("创建考试")
ResultVO<Exam> createExam(@RequestBody ExamCreateVo examCreateVo, HttpServletRequest request) {
@ -147,6 +183,12 @@ public class ExamController {
return resultVO;
}
/**
* @Description: 使examService.updateExam(),ResultVO,
* @param examVo
* @param request id
* @return
*/
@PostMapping("/update")
@ApiOperation("更新考试")
ResultVO<Exam> updateExam(@RequestBody ExamVo examVo, HttpServletRequest request) {
@ -163,6 +205,10 @@ public class ExamController {
return resultVO;
}
/**
* @Description:
* @return ResultVO<List<ExamCardVo>>
*/
@GetMapping("/card/list")
@ApiOperation("获取考试列表,适配前端卡片列表")
ResultVO<List<ExamCardVo>> getExamCardList() {
@ -178,6 +224,11 @@ public class ExamController {
return resultVO;
}
/**
* @Description: id
* @param id id
* @return ResultVO<ExamDetailVo>
*/
@GetMapping("/detail/{id}")
@ApiOperation("根据考试的id获取考试详情")
ResultVO<ExamDetailVo> getExamDetail(@PathVariable String id) {
@ -192,6 +243,13 @@ public class ExamController {
return resultVO;
}
/**
* @Description: 使examService.finishExam,ResultVO,
* @param examId id
* @param answersMap
* @param request id
* @return
*/
@PostMapping("/finish/{examId}")
@ApiOperation("根据用户提交的答案对指定id的考试判分")
ResultVO<ExamRecord> finishExam(@PathVariable String examId, @RequestBody HashMap<String, List<String>> answersMap, HttpServletRequest request) {
@ -209,6 +267,11 @@ public class ExamController {
return resultVO;
}
/**
* @Description: 使examService.getExamRecordList,ResultVO,
* @param request id
* @return ResultVO<List<ExamRecordVo>> ResultVOResultVO
*/
@GetMapping("/record/list")
@ApiOperation("获取当前用户的考试记录")
ResultVO<List<ExamRecordVo>> getExamRecordList(HttpServletRequest request) {
@ -226,6 +289,11 @@ public class ExamController {
return resultVO;
}
/**
* @Description: 使examService.getExamRecordDetail,ResultVO,id
* @param recordId id
* @return ResultVO<RecordDetailVo> ResultVOResultVO
*/
@GetMapping("/record/detail/{recordId}")
@ApiOperation("根据考试记录id获取考试记录详情")
ResultVO<RecordDetailVo> getExamRecordDetail(@PathVariable String recordId) {

@ -1,24 +1,38 @@
/***********************************************************
* @Description :
* @author : 广(Laing Shan Guang)
* @date : 2019-06-23 19:30
* @email : liangshanguang2@gmail.com
***********************************************************/
package lsgwr.exam.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* @Description: ,便JSON
* API,JSON
* Lombok@Datagettersetter
* Jackson@JsonPropertyJSON使
*/
@Data
public class ExamCardVo {
/**
* ID
*/
@JsonProperty("id")
private String examId;
/**
*
*/
@JsonProperty("title")
private String examName;
/**
*
*/
@JsonProperty("avatar")
private String examAvatar;
/**
*
*/
@JsonProperty("content")
private String examDescription;
/**
*
*/
@JsonProperty("score")
private Integer examScore;
/**

Loading…
Cancel
Save