<?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.qmth.teachcloud.report.business.mapper.TBPaperStructMapper">

    <select id="findQuestionInfo" resultType="com.qmth.teachcloud.report.business.bean.result.TBPaperStructResult">
        SELECT
            paper_type AS paperType,
            question_name AS questionName,
            big_question_number AS mainNumber,
            small_question_number AS subNumber,
            full_score AS fullScore,
            knowledge_dimension AS knowledgeDimension,
            ability_dimension AS abilityDimension,
            ROUND(CONVERT( score_rate * 100 , DECIMAL (10 , 4 )),
            2) AS scoreRate,
            difficult,
            CONVERT( validity , DECIMAL (10 , 4 )) AS validity,
            paper_struct_judge AS paperStructJudge
        FROM
            t_a_paper_struct
        <where>
            <if test="examId != null and examId != ''">
                and exam_id = #{examId}
            </if>
            <if test="courseCode != null and courseCode != ''">
                and course_code = #{courseCode}
            </if>
        </where>
    </select>
    <select id="findQuestionInfoByTeacherCollege"
            resultType="com.qmth.teachcloud.report.business.bean.result.TBPaperStructResult">
        SELECT
            paper_type AS paperType,
            question_name AS questionName,
            big_question_number AS mainNumber,
            small_question_number AS subNumber,
            full_score AS fullScore,
            knowledge_dimension AS knowledgeDimension,
            ability_dimension AS abilityDimension,
            ROUND(CONVERT( score_rate * 100 , DECIMAL (10 , 4 )),
                  2) AS scoreRate,
            difficult,
            paper_struct_judge AS paperStructJudge
        FROM
            t_a_exam_course_teacher_college_paper_struct
        <where>
            <if test="examId != null and examId > 0">
                and exam_id = #{examId}
            </if>
            <if test="courseCode != null and courseCode.length > 0">
                and course_code = #{courseCode}
            </if>
            <if test="inspectCollegeId != null and inspectCollegeId > 0">
                and inspect_college_id = #{inspectCollegeId}
            </if>
            <if test="teacherId != null and teacherId > 0">
                and teacher_id = #{teacherId}
            </if>
        </where>
    </select>
</mapper>
