龚焕茏
2024-07-01 93b0c663078aa47828d5aabe901a4b4c4ee92632
src/main/resources/mapper/ExamPaperScoreMapper.xml
@@ -3,38 +3,52 @@
<mapper namespace="com.ycl.jxkg.mapper.ExamPaperScoreMapper">
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.entity.ExamPaperScore">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="paper_id" jdbcType="INTEGER" property="examPaperId"/>
        <result column="paper_name" jdbcType="VARCHAR" property="paperName"/>
        <result column="exam_id" jdbcType="INTEGER" property="examId"/>
        <result column="exam_name" jdbcType="VARCHAR" property="examName"/>
        <result column="paper_type" jdbcType="INTEGER" property="paperType"/>
        <result column="user_score" jdbcType="INTEGER" property="userScore"/>
        <result column="paper_score" jdbcType="INTEGER" property="paperScore"/>
        <result column="score" jdbcType="INTEGER" property="score"/>
        <result column="total_score" jdbcType="INTEGER" property="totalScore"/>
        <result column="question_correct" jdbcType="INTEGER" property="questionCorrect"/>
        <result column="question_count" jdbcType="INTEGER" property="questionCount"/>
        <result column="do_time" jdbcType="INTEGER" property="doTime"/>
        <result column="status" jdbcType="INTEGER" property="status"/>
        <result column="create_user" jdbcType="INTEGER" property="createUser"/>
        <result column="user_id" jdbcType="INTEGER" property="userId"/>
        <result column="judge_user" jdbcType="INTEGER" property="judgeUser"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="answer_time" jdbcType="TIMESTAMP" property="answerTime"/>
        <result column="submit_time" jdbcType="TIMESTAMP" property="submitTime"/>
        <result column="exam_id" jdbcType="INTEGER" property="examId"/>
        <result column="exam_name" jdbcType="INTEGER" property="examName"/>
        <result column="paper_content" jdbcType="INTEGER" property="paperContent"/>
    </resultMap>
    <sql id="Base_Column_List">
        id, paper_id, paper_name, paper_type, user_score,paper_score,
        question_correct, question_count, do_time, status, create_user, create_time,
        judge_user,answer_time,paper_content,create_time
        id,
        exam_id,
        exam_name,
        paper_id,
        paper_type,
        score,
        total_score,
        question_correct,
        question_count,
        do_time,
        status,
        user_id,
        judge_user,
        submit_time,
        paper_content,
        navbar,
        judge_time,
        deleted
    </sql>
    <select id="studentPage" resultMap="BaseResultMap"
            parameterType="com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageVO">
    <select id="studentPage" resultType="com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_exam_paper_answer
        FROM t_exam_paper_score
        <where>
            and create_user = #{createUser}
            <if test="subjectId != null">
                and subject_id = #{subjectId}
            and user_id = #{createUser}
            <if test="examName != null and examName != ''">
                and INSTR(exam_name, #{examName})
            </if>
        </where>
    </select>
@@ -52,11 +66,9 @@
    <select id="selectCountByDate" resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name, COUNT(create_time) as value
        from
            (
            SELECT DATE_FORMAT(create_time, '%Y-%m-%d') as create_time from t_exam_paper_score
            WHERE create_time between #{startTime} and #{endTime}
            ) a
        from (SELECT DATE_FORMAT(create_time, '%Y-%m-%d') as create_time
              from t_exam_paper_score
              WHERE create_time between #{startTime} and #{endTime}) a
        GROUP BY create_time
    </select>
@@ -65,21 +77,19 @@
        select
        <include refid="Base_Column_List"/>
        from t_exam_paper_score
        where paper_id = #{pid} and create_user=#{uid}
        where paper_id = #{pid} and user_id=#{uid}
        limit 1
    </select>
    <select id="adminPage" resultType="com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO">
        SELECT
        a.id , exam_paper_id, paper_name, paper_type, system_score, user_score, paper_score,
        question_correct, question_count, do_time, a.status, create_user, a.create_time, b.real_name AS userName
        FROM t_exam_paper_answer a
        LEFT JOIN t_user b ON a.create_user = b.id
        a.*, b.real_name AS userName, c.name as paperName
        FROM t_exam_paper_score a
        INNER JOIN t_user b ON a.user_id = b.id AND b.deleted = 0
        INNER JOIN t_exam_paper c ON a.paper_id = c.id AND c.deleted = 0
        <where>
            <if test="examPaperId != null">
                AND paper_id = #{examPaperId}
            </if>
            exam_id = #{examId}
            <if test="userName != null and userName != ''">
                AND INSTR(b.real_name, #{userName})
            </if>
@@ -88,9 +98,9 @@
    <select id="pageExamPaper" resultType="com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO">
        SELECT
        a.id,
        t.id,
        a.name AS paperName,
        a.score AS systemScore,
        a.score AS totalScore,
        a.num as questionCount,
        a.subject_id,
        a.paper_type,
@@ -102,9 +112,9 @@
        t.exam_name
        FROM t_exam_paper a
        INNER JOIN t_exam t ON a.id = t.exam_paper_id AND t.deleted = 0
        LEFT JOIN t_subject b ON a.subject_id = b.id
        LEFT JOIN t_user c ON t.teacher_id = c.id
        LEFT JOIN t_exam_paper_answer d ON a.id = d.exam_paper_id
        LEFT JOIN t_subject b ON a.subject_id = b.id AND b.deleted = 0
        LEFT JOIN t_user c ON t.teacher_id = c.id AND c.deleted = 0
        LEFT JOIN t_exam_paper_score d ON t.id = d.exam_id
        LEFT JOIN t_exam_paper_classes e ON a.id = e.exam_paper_id
        LEFT JOIN t_classes_user f ON e.classes_id = f.classes_id
        <where>