fuliqi
2024-06-28 16b4725365f3286c2d2a80945e26f35f89b53f24
src/main/resources/mapper/ExamMapper.xml
@@ -16,6 +16,7 @@
        <result column="teacher_id" property="teacherId" />
        <result column="class_name" property="className" />
        <result column="name" property="examPaperName" />
        <result column="isContinue" property="isContinue" />
    </resultMap>
@@ -72,6 +73,8 @@
            <if test="query.classesId != null">
                AND TE.classes_id = #{query.classesId}
            </if>
        ORDER BY
            TE.create_time DESC
    </select>
@@ -83,17 +86,18 @@
            TE.exam_paper_type,
            TE.exam_place,
            TE.status,
            IF(TE.status != 'not_start', IF(TE.status == 'ing', 1, 2), 0) as orderc,
            IF(TE.status != 'not_start', IF(TE.status = 'ing', 2, 1), 0) as orderc,
            TE.start_time,
            TE.end_time,
            TE.create_time,
            TE.teacher_id,
            TE.id,
            TC.class_name,
            TEP.name
            TEP.name,
            (SELECT IF(COUNT(*) > 0, true, false) FROM t_exam_submit_temp WHERE user_id = #{userId} AND status = 'temp') as isContinue
        FROM
            t_exam TE
        INNER JOIN t_classes TC ON TC.id = TE.classes_id AND TC.deleted = 0
        INNER JOIN t_classes TC ON TC.id = TE.classes_id AND TC.deleted = 0 AND TC.status = 'normal'
        INNER JOIN t_classes_user TCU ON TC.id = TCU.classes_id AND TC.deleted = 0 AND TCU.user_id = #{userId}
        INNER JOIN t_exam_paper TEP ON TEP.id = TE.exam_paper_id AND TEP.deleted = 0
        WHERE
@@ -101,7 +105,10 @@
            <if test="query.examName != null and query.examName != ''">
                AND TE.exam_name like concat('%', #{query.examName}, '%')
            </if>
        ORDER BY orderc DESC
            <if test="query.status != null and query.status != ''">
                AND TE.status = #{query.status}
            </if>
        ORDER BY orderc, TE.create_time DESC
    </select>
</mapper>