<?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.sundot.airport.exam.mapper.WeakModuleAnalysisMapper">

    <!-- 查询用户的薄弱模块列表（按正确率升序） -->
    <select id="selectWeakModulesByUserId" resultType="com.sundot.airport.exam.domain.WeakModuleAnalysis">
        SELECT
            id,
            wma_id,
            wma_user_id,
            wma_module_id,
            wma_module_name,
            wma_total_count,
            wma_correct_count,
            wma_correct_rate,
            wma_last_3_total,
            wma_last_3_correct,
            wma_last_3_rate,
            wma_is_weak,
            wma_update_time,
            del_status,
            create_time,
            create_uid,
            update_time,
            update_uid
        FROM edu_cs_weak_module_analysis
        WHERE wma_user_id = #{userId}
          AND del_status = 0
          AND wma_last_3_total > 0
        ORDER BY wma_last_3_rate ASC, wma_correct_rate ASC
    </select>

</mapper>
