src/main/java/com/ycl/jxkg/controller/admin/ExamPaperController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/ycl/jxkg/domain/entity/ExamPaperQuestion.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/ycl/jxkg/domain/question/QuestionDTO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/ycl/jxkg/domain/vo/admin/paper/ExamPaperQuestionVO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/ycl/jxkg/mapper/ExamPaperQuestionMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/ycl/jxkg/service/ExamPaperQuestionService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/ycl/jxkg/service/impl/ExamPaperQuestionServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/ExamPaperQuestionMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/ycl/jxkg/controller/admin/ExamPaperController.java
@@ -3,11 +3,14 @@ import com.ycl.jxkg.base.BaseApiController; import com.ycl.jxkg.base.Result; import com.ycl.jxkg.domain.entity.ExamPaper; import com.ycl.jxkg.domain.entity.ExamPaperQuestion; import com.ycl.jxkg.domain.form.ExamPaperForm; import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperQuestionVO; import com.ycl.jxkg.enums.VisibilityEnum; import com.ycl.jxkg.group.Add; import com.ycl.jxkg.group.Update; import com.ycl.jxkg.mapper.ExamPaperMapper; import com.ycl.jxkg.service.ExamPaperQuestionService; import com.ycl.jxkg.service.ExamPaperService; import com.ycl.jxkg.utils.DateTimeUtil; import com.ycl.jxkg.utils.PageInfoHelper; @@ -18,6 +21,7 @@ import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -28,10 +32,12 @@ @RestController("AdminExamPaperController") @RequestMapping(value = "/api/admin/exam/paper") public class ExamPaperController extends BaseApiController { private final ExamPaperService examPaperService; private final ExamPaperMapper baseMapper; @Autowired private ExamPaperService examPaperService; @Autowired private ExamPaperQuestionService examPaperQuestionService; @Autowired private ExamPaperMapper baseMapper; @RequestMapping(value = "/page", method = RequestMethod.POST) public Result<PageInfo<ExamResponseVO>> pageList(@RequestBody ExamPaperPageRequestVO model) { @@ -65,11 +71,22 @@ if (!StringUtils.isBlank(form.getVisibility())) { form.setVisibility(VisibilityEnum.fromCode(form.getVisibility()).getName()); } //TODO:修改联表里的分数 ExamPaper entity = ExamPaperForm.getEntityByForm(form,null); examPaperService.updateById(entity); return Result.ok(); } @RequestMapping(value = "/editQuestion", method = RequestMethod.POST) public Result editQuestion(@RequestBody ExamPaperForm form) { return Result.ok(); } @RequestMapping(value = "/selectQuestion/{id}", method = RequestMethod.POST) public Result<ExamPaperQuestion> selectQuestion(@PathVariable Integer id) { ExamPaperQuestion vo = examPaperQuestionService.selectById(id); return Result.ok(vo); } @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) public Result<ExamPaperEditRequestVO> select(@PathVariable Integer id) { ExamPaperEditRequestVO vm = examPaperService.examPaperToVM(id); src/main/java/com/ycl/jxkg/domain/entity/ExamPaperQuestion.java
New file @@ -0,0 +1,22 @@ package com.ycl.jxkg.domain.entity; import com.ycl.jxkg.domain.question.QuestionDTO; import lombok.Data; import java.math.BigDecimal; import java.util.List; @Data public class ExamPaperQuestion { private Integer id; private String name; private Integer templateId; private Integer paperType; private Integer subjectId; private Integer suggestTime; private Integer deductType; private BigDecimal deductTypeScore; private BigDecimal score; private List<QuestionDTO> questions; } src/main/java/com/ycl/jxkg/domain/question/QuestionDTO.java
New file @@ -0,0 +1,52 @@ package com.ycl.jxkg.domain.question; import com.ycl.jxkg.domain.base.AbsEntity; import com.ycl.jxkg.enums.general.StatusEnum; import lombok.Data; import java.math.BigDecimal; import java.util.Date; @Data public class QuestionDTO extends AbsEntity { /** * 1.单选题 2.多选题 3.判断题 4.填空题 5.简答题 */ private Integer questionType; /** * 学科 */ private Integer subjectId; /** * 题目难度 */ private Integer difficult; /** * 正确答案 */ private String correct; /** * 题目 填空、 题干、解析、答案等信息 */ private String content; /** * 创建人 */ private Integer createUser; /** * 1.启用、2.禁用 */ private StatusEnum status; /** * 创建时间 */ private Date createTime; private BigDecimal score; } src/main/java/com/ycl/jxkg/domain/vo/admin/paper/ExamPaperQuestionVO.java
New file @@ -0,0 +1,20 @@ package com.ycl.jxkg.domain.vo.admin.paper; import lombok.Data; import java.math.BigDecimal; import java.util.Map; @Data public class ExamPaperQuestionVO { private Integer id; private String name; private Integer templateId; private Integer paperType; private Integer subjectId; private Integer suggestTime; private Integer deductType; private BigDecimal deductTypeScore; private BigDecimal score; private Map<Integer,Object> questionMap; } src/main/java/com/ycl/jxkg/mapper/ExamPaperQuestionMapper.java
New file @@ -0,0 +1,10 @@ package com.ycl.jxkg.mapper; import com.ycl.jxkg.domain.entity.ExamPaperQuestion; import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperQuestionVO; import org.apache.ibatis.annotations.Mapper; @Mapper public interface ExamPaperQuestionMapper { ExamPaperQuestion selectById(Integer id); } src/main/java/com/ycl/jxkg/service/ExamPaperQuestionService.java
New file @@ -0,0 +1,9 @@ package com.ycl.jxkg.service; import com.ycl.jxkg.domain.entity.ExamPaperQuestion; import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperQuestionVO; public interface ExamPaperQuestionService { ExamPaperQuestion selectById(Integer id); } src/main/java/com/ycl/jxkg/service/impl/ExamPaperQuestionServiceImpl.java
New file @@ -0,0 +1,20 @@ package com.ycl.jxkg.service.impl; import com.ycl.jxkg.domain.entity.ExamPaperQuestion; import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperQuestionVO; import com.ycl.jxkg.mapper.ExamPaperQuestionMapper; import com.ycl.jxkg.service.ExamPaperQuestionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class ExamPaperQuestionServiceImpl implements ExamPaperQuestionService { @Autowired private ExamPaperQuestionMapper examPaperQuestionMapper; @Override public ExamPaperQuestion selectById(Integer id) { return examPaperQuestionMapper.selectById(id); } } src/main/resources/mapper/ExamPaperQuestionMapper.xml
New file @@ -0,0 +1,31 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ycl.jxkg.mapper.ExamPaperQuestionMapper"> <resultMap id="ExamPaperQuestionMap" type="com.ycl.jxkg.domain.entity.ExamPaperQuestion"> <id column="id" property="id"/> <result column="name" property="name"/> <result column="subject_id" property="subjectId"/> <result column="paper_type" property="paperType"/> <result column="score" property="score"/> <result column="suggest_time" property="suggestTime"/> <collection property="questions" ofType="com.ycl.jxkg.domain.question.QuestionDTO"> <id column="questionId" property="id"/> <result column="questionScore" property="score"/> <result column="question_type" property="questionType"/> <result column="difficult" property="difficult"/> <result column="correct" property="correct"/> <result column="content" property="content"/> </collection> </resultMap> <select id="selectById" resultMap="ExamPaperQuestionMap"> select tep.id,tep.name,tep.subject_id,tep.paper_type,tep.score,tep.suggest_time, tepq.score as questionScore,tq.id as questionId,tq.question_type,tq.difficult,tq.correct,tq.content from t_exam_paper tep left join t_exam_paper_question tepq on tep.id =tepq.exam_paper_id left join t_question tq on tepq.question_id = tq.id where tep.id = #{id} and tq.status = 1 and tq.deleted = 0 </select> </mapper>