智慧保安后台管理-外网项目备份
钟日健
2022-02-25 afc2b4d2800d91c793523d14fbe2d6fbbd319fc0
模拟考试开始修改,返回所有题目的所有答题信息
4 files modified
59 ■■■■ changed files
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml 44 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamSubjectChoicesMapper.xml 3 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/simulateexam/mapper/SimulateExamRecordMapper.xml 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/simulateexam/service/impl/SimulateExamRecordServiceImpl.java 11 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml
@@ -534,22 +534,48 @@
        ) aa,(select @i:=0) bb
    </select>
    <select id="queryRandomSubjectList" resultType="org.springblade.modules.exam.vo.ExamSubjectChoicesVO">
    <!--ExamSubjectChoicesInfoMap 多表联查 一对多查询 -->
    <resultMap id="ExamSubjectChoicesInfoMap" type="org.springblade.modules.exam.vo.ExamSubjectChoicesVO">
        <id property="id" column="id"/>
        <id property="categoryId" column="category_id"/>
        <id property="subjectName" column="subject_name"/>
        <id property="choicesType" column="choices_type"/>
        <id property="answer" column="answer"/>
        <id property="score" column="score"/>
        <id property="level" column="level"/>
        <result column="id" property="id"/>
        <collection property="examSubjectOptions" javaType="java.util.List" ofType="org.springblade.modules.exam.entity.ExamSubjectOption" autoMapping="true">
            <id property="id" column="eso_id"/>
        </collection>
    </resultMap>
    <select id="queryRandomSubjectList" resultMap="ExamSubjectChoicesInfoMap">
        select
        id,
        category_id categoryId,
        subject_name subjectName,
        choices_type choicesType,
        score,
        analysis,
        tktype
        esc.id,esc.category_id,esc.subject_name,esc.choices_type,esc.score,esc.answer,
        eso.id eso_id,eso.subject_choices_id,eso.option_name,eso.option_content,eso.creator,
        eso.create_date,eso.modifier,eso.modify_date,eso.del_flag,eso.application_code,eso.tenant_code
        from (
            select
            id,
            category_id,
            subject_name,
            choices_type,
            score,
            answer,
            analysis,
            tktype
            from (
            select * from exam_subject_choices
            where id in
            <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        ) a ORDER BY RAND() LIMIT #{number}
            ) a ORDER BY RAND() LIMIT #{number}
        ) esc
        left join
        exam_subject_option eso
        on
        esc.id = eso.subject_choices_id
    </select>
src/main/java/org/springblade/modules/exam/mapper/ExamSubjectChoicesMapper.xml
@@ -46,6 +46,7 @@
        <id property="categoryId" column="category_id"/>
        <id property="subjectName" column="subject_name"/>
        <id property="choicesType" column="choices_type"/>
        <id property="answer" column="answer"/>
        <id property="score" column="score"/>
        <id property="level" column="level"/>
        <result column="id" property="id"/>
@@ -58,7 +59,7 @@
    <!--题目详情信息-->
    <select id="selectExamSubjectChoicesInfo" resultMap="ExamSubjectChoicesInfoMap">
        SELECT
        esc.id,esc.category_id,esc.subject_name,esc.choices_type,esc.score,esc.level,
        esc.id,esc.category_id,esc.subject_name,esc.choices_type,esc.score,esc.level,esc.answer,
        eso.id eso_id,eso.subject_choices_id,eso.option_name,eso.option_content,eso.creator,
        eso.create_date,eso.modifier,eso.modify_date,eso.del_flag,eso.application_code,eso.tenant_code
        FROM
src/main/java/org/springblade/modules/simulateexam/mapper/SimulateExamRecordMapper.xml
@@ -19,6 +19,7 @@
        category_id categoryId,
        subject_name subjectName,
        choices_type choicesType,
        answer,
        score,
        analysis,
        tktype
src/main/java/org/springblade/modules/simulateexam/service/impl/SimulateExamRecordServiceImpl.java
@@ -99,13 +99,13 @@
                List<ExamSubjectChoicesVO> radioRandomSubjectList = examPaperService.queryRandomSubjectList(radio,25);
                List<ExamSubjectChoicesVO> checkboxRandomSubjectList = examPaperService.queryRandomSubjectList(checkbox,10);
                List<ExamSubjectChoicesVO> judgeRandomSubjectList = examPaperService.queryRandomSubjectList(judge,20);
                List<ExamSubjectChoicesVO> sortRandomSubjectList = examPaperService.queryRandomSubjectList(sort,5);
//                List<ExamSubjectChoicesVO> sortRandomSubjectList = examPaperService.queryRandomSubjectList(sort,5);
                //合并集合数据
                choicesVOList.addAll(radioRandomSubjectList);
                choicesVOList.addAll(checkboxRandomSubjectList);
                choicesVOList.addAll(judgeRandomSubjectList);
                choicesVOList.addAll(sortRandomSubjectList);
//                choicesVOList.addAll(sortRandomSubjectList);
                //取出考试id
                List<Long> longList = choicesVOList.stream().map(ExamSubjectChoicesVO::getId).collect(Collectors.toList());
@@ -124,9 +124,14 @@
                simulateExamRecord.setStatus(1);
                //新增模拟考试记录信息
                boolean status = this.save(simulateExamRecord);
                ExamSubjectChoices examSubjectChoices = new ExamSubjectChoices();
                examSubjectChoices.setId(choicesVOList.get(0).getId());
                ExamSubjectChoicesVO examSubjectChoicesVO = examSubjectChoicesService.selectExamSubjectChoicesInfo(examSubjectChoices);
                if (status){
                    map.put("simulateExamRecord",simulateExamRecord);
                    map.put("examSubjectInfo",choicesVOList);
                    map.put("examSubjectChoicesVO",examSubjectChoicesVO);
                    //返回信息
                    return map;
                }
@@ -165,7 +170,7 @@
    /**
     * 考试暂停后继续,1查询所有的答题信息,2查询所有的已答信息  3其他信息
     * @param simulateExamRecord 必须包含 模拟考试id,id_card_no, type 1: 继续考试  2: 放弃之前的考试,重新生成题目考试
     * @param simulateExamRecord 必须包含 模拟考试id,, type 1: 继续考试  2: 放弃之前的考试,重新生成题目考试
     * @return
     */
    @Override