Blame view

SubjectTestPublishHistoryMapper.xml 7.28 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
<?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.meishu.mapper.SubjectTestPublishHistoryMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.meishu.model.SubjectTestPublishHistoryDO">
        <id column="id" property="id"/>
        <result column="create_date" property="createTime"/>
        <result column="update_date" property="updateTime"/>
        <result column="delete_date" property="deleteTime"/>
        <!--        <result column="rule_id" property="ruleId" />-->
        <!--        <result column="deadline" property="deadline" />-->
        <!--        <result column="outline" property="outline" />-->
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, rule_id, deadline, outline
    </sql>


    <select id="getStudentExamination"
            resultType="com.meishu.vo.rule.GetStudentRulesVO">
              SELECT
            t.id,
            t2.rule_name,
            t.outline,
            t5.create_date,
            t.test_time,
            t4.examination,
            t3.subject_name,
            t.cover_page,
            t.test_type,
            t.publish_name
        FROM
            subject_test_student_answer t5
            LEFT JOIN subject_test_publish_history t ON t5.publish_id = t.id
            LEFT JOIN subject_test_dict t4 ON t.test_id = t4.id
            LEFT JOIN subject_rule t2 ON t4.rule_id = t2.id
            LEFT JOIN knowledge_subject_dict t3 ON t2.subject_id = t3.id
            left join student t6 on t5.student_id = t6.id
        WHERE
            t5.student_id = #{id}
            <if test="subjectId!=null and subjectId!=''">
                and t2.subject_id = #{subjectId}
            </if>
            and t6.status = 1
            AND t.delete_date IS NULL
            AND t4.delete_date IS NULL
            AND t5.delete_date IS NULL
    </select>

    <select id="getOneExaminationDetail" parameterType="com.meishu.model.SubjectTestStudentAnswerDO"
            resultType="com.meishu.vo.rule.GetOneExaminationDetailVO">
         SELECT
            t2.id,
            t4.subject_name,
            t3.rule_name,
            t5.examination,
            t2.answer,
            t1.test_time ,
            t1.publish_name,
            t1.test_type,
            t2.create_date as commitTime
        FROM
            subject_test_publish_history t1
            LEFT JOIN subject_test_student_answer t2 ON t1.id = t2.publish_id
            left join subject_test_dict t5 on t1.test_id = t5.id
            LEFT JOIN subject_rule t3 ON t5.rule_id = t3.id
            LEFT JOIN knowledge_subject_dict t4 ON t3.subject_id = t4.id
        WHERE
            t2.student_id = #{studentId} and t1.id = #{publishId}
            AND t1.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            AND t4.delete_date IS NULL
            and t5.delete_date is null
    </select>

    <select id="studentStar" parameterType="com.meishu.model.SubjectTestStudentAnswerDO"
            resultType="com.meishu.vo.rule.StudentStarVO">
        SELECT
            t3.dimension,
            t2.star,
            t2.description,
            t4.user_name
        FROM
            subject_student_answer_star t
            LEFT JOIN subject_dimension_star_dict t2 ON t.star_id = t2.id
            LEFT JOIN subject_dimension_dict t3 ON t2.dimension_id = t3.id
            LEFT JOIN administer t4 ON t.administer_id = t4.id
        WHERE
            t.publish_id = #{publishId}
            AND t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            AND t4.delete_date IS NULL
    </select>

    <select id="getTestReport" resultType="com.meishu.vo.test.GetTestReportVO">
        SELECT
        t.id,
        t.publish_name,
        t3.rule_name,
        t2.test_name,
        t.test_time,
        t4.to_cnt,
        t5.done_cnt
        FROM
        subject_test_publish_history t
        LEFT JOIN subject_test_dict t2 ON t.test_id = t2.id
        LEFT JOIN subject_rule t3 ON t2.rule_id = t3.id
        LEFT JOIN ( SELECT t.publish_id, count( 1 ) AS to_cnt FROM subject_test_student_answer t WHERE t.`commit_status` = 1 GROUP BY t.publish_id ) t4 ON t.id = t4.publish_id
        LEFT JOIN ( SELECT t.publish_id, count( 1 ) AS done_cnt FROM subject_test_student_answer t WHERE t.`commit_status` = 0 GROUP BY t.publish_id ) t5 ON t.id = t5.publish_id
        WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        AND t3.delete_date IS NULL
        <if test="ruleId !=null and ruleId != ''">
            AND t3.id = #{ruleId}
        </if>
        <if test="publishName!=null and publishName!=''">
            and t.publish_name = #{publishName}
        </if>
    </select>

    <select id="getPublishHistory"  resultType="com.meishu.vo.test.GetPublishHistoryVO">
        SELECT
            t.id,
            t2.id as testId,
            t.publish_name,
            t3.rule_name,
            t.test_time,
            t2.test_name,
            t2.examination,
            t.outline,
            t.cover_page
        FROM
            subject_test_publish_history t
            LEFT JOIN subject_test_dict t2 ON t.test_id = t2.id
            LEFT JOIN subject_rule t3 ON t2.rule_id = t3.id
        WHERE
            t.delete_date IS NULL
            <if test="ruleId != null and ruleId !=''">
                and t3.id = #{ruleId}
            </if>
            <if test="publishName!=null and publishName !=''">
                and t.publish_name = #{publishName}
            </if>
    </select>

    <select id="getOnePublish" resultType="com.meishu.vo.test.GetOnePublishVO">
        SELECT
            t.id,
            t.student_id,
            t.publish_id,
            t2.username,
            t.answer,
            t.comment_status
        FROM
            subject_test_student_answer t
            LEFT JOIN student t2 ON t.student_id = t2.id
            LEFT JOIN campus_dict t3 ON t2.campus_id = t3.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            <if test="id !=null and id !=''">
                AND t.publish_id = #{id}
            </if>
            <if test="commentStatus!=null and commentStatus!=''">
                AND t.comment_status = #{commentStatus}
            </if>
            <if test="userName!=null and userName!=''">
                and t2.user_name = #{userName}
            </if>
    </select>

    <select id="getCommentDetail" parameterType="com.meishu.vo.test.GetOnePublishVO" resultType="com.meishu.vo.test.CommentVO">
        SELECT
            t2.user_name,
            t3.dimension,
            t4.star
        FROM
            subject_student_answer_star t
            LEFT JOIN administer t2 ON t.administer_id = t2.id
            LEFT JOIN subject_dimension_dict t3 ON t.administer_id = t3.id
            LEFT JOIN subject_dimension_star_dict t4 ON t.star_id = t4.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            AND t4.delete_date IS NULL
            and t.publish_id = #{publishId}
            and t.student_id = #{studentId}
    </select>
</mapper>