“djh”
2024-12-27 3aae8ddd5b9624626921abdcc33122dccdcd5c61
exam-system/src/main/resources/mapper/institutionaccess/ThExamRecordMapper.xml
@@ -11,7 +11,7 @@
        LEFT JOIN th_student s ON s.idcard = e.idcard
        LEFT JOIN th_batch b ON b.uuid = e.batch_uuid
        WHERE
        e.del_flag = 0
        e.del_flag = 0 and s.del_flag = 0 and b.del_flag = 0
        <if test="query.idcard != null and query.idcard != ''">
            and e.idcard = #{query.idcard}
        </if>
@@ -46,5 +46,31 @@
        </foreach>
    </select>
    <select id="getStatistic" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThTrainVO">
        SELECT
        e.institution_id,
        count(DISTINCT e.idcard) passCount
        FROM
        th_exam_record e
        LEFT JOIN th_batch b ON e.batch_uuid = b.uuid
        WHERE
        e.del_flag = 0
        AND e.exam_is_pass = 1
        AND b.have_exam = 1
        <if test="query.subjectCode != null and query.subjectCode != ''">
            and b.subject_code like concat(#{query.subjectCode}, '%')
        </if>
        <if test="query.trainOrgName != null and query.trainOrgName != ''">
            and b.train_org_name = #{query.trainOrgName}, '%')
        </if>
        <if test="query.startTime != null"><!-- 开始时间检索 -->
            and date_format(b.actual_start_time,'%y-%m-%d') &gt;= date_format(#{query.startTime},'%y-%m-%d')
        </if>
        <if test="query.endTime != null"><!-- 结束时间检索 -->
            and date_format(b.actual_start_time,'%y-%m-%d') &lt;= date_format(#{query.endTime},'%y-%m-%d')
        </if>
        GROUP BY
        e.institution_id
    </select>
</mapper>