src/main/java/org/springblade/modules/exam/controller/ExamPaperController.java
@@ -18,8 +18,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; @@ -113,4 +111,26 @@ return R.status(temp); } /** * 考试题目绑定 */ @GetMapping("/setPagerSubject") @ApiOperationSupport(order = 8) @ApiOperation(value = "考试题目绑定", notes = "传入exam") public R setPagerSubject(@ApiParam(value = "主键集合") ExamPaper exam) { return R.status(true); } /** * 查询考试题目 */ @GetMapping("/queryPagerSubject") @ApiOperationSupport(order = 8) @ApiOperation(value = "考试题目绑定", notes = "传入exam") public R<ExamPaperVO> queryPagerSubject(@ApiParam(value = "主键集合") ExamPaper exam) { ExamPaperVO subject = examPaperService.queryPagerSubject(exam); return R.data(subject); } } src/main/java/org/springblade/modules/exam/entity/ExamPaper.java
@@ -49,50 +49,42 @@ /** * 考试名称 */ @TableField("exam_name") private String exam_name; private String examName; /** * 考试类型 */ @TableField("exam_type") private String exam_type; private Integer examType; /** * 注意事项 */ @TableField("exam_attention") private String exam_attention; private String examAttention; /** * 考试开始时间 */ @TableField("start_time") private Date start_time; private Date startTime; /** * 考试结束时间 */ @TableField("end_time") private Date end_time; private Date endTime; /** * 时间区间 */ @TableField("exam_time") private String exam_time; private String examTime; /** * 总分 */ @TableField("total_score") private String total_score; private String totalScore; /** * 状态 */ @TableField("exam_status") private String exam_status; private Integer examStatus; /** * 创建人 @@ -102,8 +94,7 @@ /** * 创建时间 */ @TableField("creator_date") private Date creator_date; private Date creatorDate; /** * 备注 src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.java
@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.apache.ibatis.annotations.Param; import org.springblade.modules.desk.entity.Notice; import org.springblade.modules.desk.vo.NoticeVO; import org.springblade.modules.exam.entity.ExamPaper; @@ -32,5 +33,5 @@ */ public interface ExamPaperMapper extends BaseMapper<ExamPaper> { ExamPaperVO queryPagerSubject(@Param("paper") ExamPaper paper); } src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml
@@ -2,19 +2,28 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.springblade.modules.exam.mapper.ExamPaperMapper"> <!-- 通用查询映射结果 --> <resultMap id="noticeResultMap" type="org.springblade.modules.exam.entity.ExamPaper"> <result column="id" property="id"/> <result column="create_user" property="createUser"/> <result column="create_time" property="createTime"/> <result column="update_user" property="updateUser"/> <result column="update_time" property="updateTime"/> <result column="status" property="status"/> <result column="is_deleted" property="isDeleted"/> <result column="release_time" property="releaseTime"/> <result column="title" property="title"/> <result column="content" property="content"/> <resultMap id="PagerSubject" type="org.springblade.modules.exam.vo.ExamPaperSubjectVO" autoMapping="true"> <id property="id" column="id"/> <collection property="subjectList" javaType="java.util.List" ofType="org.springblade.modules.exam.entity.ExamSubjectChoices" autoMapping="true"> <id property="id" column="tmxq.id"/> </collection> </resultMap> <select id="queryPagerSubject" resultMap="PagerSubject"> SELECT sj.exam_name,sj.exam_type,sj.exam_attention,sj.total_score,sj.exam_status,tmxq.id,tmxq.subject_name,tmxq.answer,tmxq.analysis FROM ksxt_exam sj LEFT JOIN exam_examination_subject tm ON sj.id = tm.examination_id LEFT JOIN exam_subject_choices tmxq ON tm.subject_id = tmxq.id WHERE 1 = 1 <if test="paper.id !=null"> and sj.id = #{paper.id} </if> </select> </mapper> src/main/java/org/springblade/modules/exam/service/ExamPaperService.java
@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.springblade.modules.exam.entity.ExamPaper; import org.springblade.modules.exam.vo.ExamPaperVO; /** * 服务类 @@ -26,6 +27,6 @@ */ public interface ExamPaperService extends IService<ExamPaper> { ExamPaperVO queryPagerSubject(ExamPaper paper); } src/main/java/org/springblade/modules/exam/service/impl/ExamPaperServiceImpl.java
@@ -20,6 +20,7 @@ import org.springblade.modules.exam.entity.ExamPaper; import org.springblade.modules.exam.mapper.ExamPaperMapper; import org.springblade.modules.exam.service.ExamPaperService; import org.springblade.modules.exam.vo.ExamPaperVO; import org.springframework.stereotype.Service; /** @@ -31,4 +32,8 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper> implements ExamPaperService { @Override public ExamPaperVO queryPagerSubject(ExamPaper paper) { return baseMapper.queryPagerSubject(paper); } } src/main/java/org/springblade/modules/exam/vo/ExamPaperSubjectVO.java
New file @@ -0,0 +1,19 @@ package org.springblade.modules.exam.vo; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.modules.exam.entity.ExamPaper; import org.springblade.modules.exam.entity.ExamSubjectChoices; import java.util.List; /** * 通知公告视图类 * * @author Chill */ @Data @EqualsAndHashCode(callSuper = true) public class ExamPaperSubjectVO extends ExamPaper { private List<ExamSubjectChoices> subjectList; }