|
@@ -41,16 +41,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
SELECT ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*)) rate
|
|
SELECT ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*)) rate
|
|
|
FROM `learn_answer` a
|
|
FROM `learn_answer` a
|
|
|
JOIN `learn_student` ls ON ls.`student_id` = a.`student_id`
|
|
JOIN `learn_student` ls ON ls.`student_id` = a.`student_id`
|
|
|
- WHERE a.`state` > 0 AND ls.`class_id` = #{classId}
|
|
|
|
|
|
|
+ WHERE a.`state` > 0 AND ls.`class_id` = #{classId}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectClassKnowledgeDetail" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
|
|
<select id="selectClassKnowledgeDetail" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
|
|
|
SELECT ls.`student_id` id, u.`nick_name` `name`
|
|
SELECT ls.`student_id` id, u.`nick_name` `name`
|
|
|
- , COUNT(*) total, SUM(IF(a.`state` = 1, 1, 0)) `value`, COUNT(DISTINCT DATE(a.create_time)) `time`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*), 1) rate
|
|
|
|
|
- FROM `learn_answer` a
|
|
|
|
|
- JOIN `learn_student` ls ON ls.`student_id` = a.`student_id`
|
|
|
|
|
- JOIN `sys_user` u ON u.`user_id` = ls.`student_id`
|
|
|
|
|
- WHERE a.`state` > 0 AND ls.`class_id` = #{classId}
|
|
|
|
|
|
|
+ , count(a.`answer_id`) total, SUM(IF(a.`state` = 1, 1, 0)) `value`, COUNT(DISTINCT DATE(a.create_time)) `time`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*), 1) rate
|
|
|
|
|
+ FROM `learn_student` ls
|
|
|
|
|
+ JOIN `sys_user` u ON u.`user_id` = ls.`student_id`
|
|
|
|
|
+ left JOIN `learn_answer` a ON ls.`student_id` = a.`student_id` and a.`state` > 0
|
|
|
|
|
+ WHERE ls.`class_id` = #{classId}
|
|
|
GROUP BY ls.`student_id`, u.`nick_name`
|
|
GROUP BY ls.`student_id`, u.`nick_name`
|
|
|
ORDER BY rate DESC, a.`student_id`
|
|
ORDER BY rate DESC, a.`student_id`
|
|
|
</select>
|
|
</select>
|
|
@@ -77,13 +77,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectClassQuestionStats" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
|
|
<select id="selectClassQuestionStats" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
|
|
|
- SELECT ls.`student_id` id, u.`nick_name` `name`, COUNT(*) total , COUNT(DISTINCT DATE(a.create_time)) `time`, SUM(IF(a.`state` = 1, 1, 0)) `value`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*), 1) rate
|
|
|
|
|
- FROM `learn_answer` a
|
|
|
|
|
- JOIN `learn_student` ls ON ls.`student_id` = a.`student_id`
|
|
|
|
|
|
|
+ SELECT ls.`student_id` id, u.`nick_name` `name`, COUNT(a.`answer_id`) total , COUNT(DISTINCT DATE(a.create_time)) `time`, SUM(IF(a.`state` = 1, 1, 0)) `value`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*), 1) rate
|
|
|
|
|
+ FROM `learn_student` ls
|
|
|
|
|
+ left JOIN `learn_answer` a ON ls.`student_id` = a.`student_id`
|
|
|
JOIN `sys_user` u ON ls.`student_id` = u.`user_id`
|
|
JOIN `sys_user` u ON ls.`student_id` = u.`user_id`
|
|
|
WHERE ls.`class_id` = #{classId}
|
|
WHERE ls.`class_id` = #{classId}
|
|
|
GROUP BY ls.`student_id`
|
|
GROUP BY ls.`student_id`
|
|
|
- ORDER BY <choose><when test="sortField=='total'">total</when><when test="sortField=='time'">`time`</when><otherwise>rate</otherwise></choose> <if test="null != desc and desc"> DESC</if>
|
|
|
|
|
|
|
+ ORDER BY if(total > 0, 0, 1), <choose><when test="sortField=='total'">total</when><when test="sortField=='time'">`time`</when><otherwise>rate</otherwise></choose> <if test="null != desc and desc"> DESC</if>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectQuestionStatsHeader" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
|
|
<select id="selectQuestionStatsHeader" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
|