|
@@ -1223,19 +1223,22 @@
|
|
<select id="countCourseRankingByComplete" resultType="FsCourseRankingVO">
|
|
<select id="countCourseRankingByComplete" resultType="FsCourseRankingVO">
|
|
SELECT
|
|
SELECT
|
|
fcv.title AS videoName,
|
|
fcv.title AS videoName,
|
|
|
|
+ fcv.video_id,
|
|
ifnull(
|
|
ifnull(
|
|
- ROUND((
|
|
|
|
- COUNT( DISTINCT CASE WHEN fcc.complete_watch_count > 0 THEN 1 END ) / count(1))* 100,
|
|
|
|
|
|
+ ROUND(
|
|
|
|
+ (
|
|
|
|
+ COUNT( DISTINCT CASE WHEN fwl.log_type = 2 THEN fwl.log_id END ) / count( DISTINCT CASE WHEN fwl.log_type != 3 THEN fwl.log_id END )) * 100,
|
|
2
|
|
2
|
|
),
|
|
),
|
|
0
|
|
0
|
|
) AS completeRate
|
|
) AS completeRate
|
|
FROM
|
|
FROM
|
|
- fs_user_course_count fcc
|
|
|
|
- LEFT JOIN fs_user ON fs_user.user_id = fcc.user_id
|
|
|
|
- LEFT JOIN company_user ON fs_user.company_user_id = company_user.user_id
|
|
|
|
- LEFT JOIN fs_user_course_period_days fcpd ON FIND_IN_SET( fcpd.period_id, fcc.course_ids ) > 0
|
|
|
|
- LEFT JOIN fs_user_course_video fcv ON fcv.video_id = fcpd.video_id
|
|
|
|
|
|
+ fs_course_watch_log fwl
|
|
|
|
+ LEFT JOIN fs_user ON fs_user.user_id = fwl.user_id
|
|
|
|
+ LEFT JOIN fs_user_company_user ON fs_user_company_user.user_id = fs_user.user_id
|
|
|
|
+ LEFT JOIN company_user ON company_user.user_id = fs_user_company_user.company_user_id
|
|
|
|
+-- LEFT JOIN fs_user_course_period_days fcpd ON FIND_IN_SET( fcpd.period_id, fcc.course_ids ) > 0
|
|
|
|
+ LEFT JOIN fs_user_course_video fcv ON fcv.video_id = fwl.video_id
|
|
<where>
|
|
<where>
|
|
<if test="userId != null and userId != 0 ">
|
|
<if test="userId != null and userId != 0 ">
|
|
AND ( fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
AND ( fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
@@ -1244,20 +1247,20 @@
|
|
and fs_user.company_id = #{companyId}
|
|
and fs_user.company_id = #{companyId}
|
|
</if>
|
|
</if>
|
|
<if test="startTime != null and startTime !='' ">
|
|
<if test="startTime != null and startTime !='' ">
|
|
- AND fcc.create_time >= #{startTime}
|
|
|
|
|
|
+ AND fwl.create_time >= #{startTime}
|
|
</if>
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
<if test="endTime != null and endTime != ''">
|
|
- AND fcc.create_time <= #{endTime}
|
|
|
|
|
|
+ AND fwl.create_time <= #{endTime}
|
|
</if>
|
|
</if>
|
|
<if test="periodId != null and periodId != ''">
|
|
<if test="periodId != null and periodId != ''">
|
|
- AND fcpd.period_id = #{periodId}
|
|
|
|
|
|
+ AND fwl.period_id = #{periodId}
|
|
</if>
|
|
</if>
|
|
<if test="videoId != null and videoId != ''">
|
|
<if test="videoId != null and videoId != ''">
|
|
- AND fcpd.video_id = #{videoId}
|
|
|
|
|
|
+ AND fwl.video_id = #{videoId}
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
GROUP BY
|
|
GROUP BY
|
|
- fcpd.video_id
|
|
|
|
|
|
+ fwl.video_id
|
|
<choose>
|
|
<choose>
|
|
<when test="order != null and order == 'asc'">
|
|
<when test="order != null and order == 'asc'">
|
|
ORDER BY completeRate asc
|
|
ORDER BY completeRate asc
|
|
@@ -1278,7 +1281,7 @@
|
|
ifnull(
|
|
ifnull(
|
|
ROUND(
|
|
ROUND(
|
|
(
|
|
(
|
|
- COUNT( DISTINCT CASE WHEN fs_course_answer_logs.is_right = 1 THEN 1 END ) / count(1)) * 100,
|
|
|
|
|
|
+ COUNT( DISTINCT CASE WHEN fs_course_answer_logs.is_right = 1 THEN fs_course_answer_logs.log_id END ) / count( DISTINCT fs_course_answer_logs.log_id)) * 100,
|
|
2
|
|
2
|
|
),
|
|
),
|
|
0
|
|
0
|
|
@@ -1286,7 +1289,8 @@
|
|
FROM
|
|
FROM
|
|
fs_course_answer_logs
|
|
fs_course_answer_logs
|
|
LEFT JOIN fs_user ON fs_user.user_id = fs_course_answer_logs.user_id
|
|
LEFT JOIN fs_user ON fs_user.user_id = fs_course_answer_logs.user_id
|
|
- LEFT JOIN company_user ON company_user.user_id = fs_user.company_user_id
|
|
|
|
|
|
+ LEFT JOIN fs_user_company_user ON fs_user_company_user.user_id = fs_user.user_id
|
|
|
|
+ LEFT JOIN company_user ON company_user.user_id = fs_user_company_user.company_user_id
|
|
LEFT JOIN fs_user_course_video fcv ON fcv.video_id = fs_course_answer_logs.video_id
|
|
LEFT JOIN fs_user_course_video fcv ON fcv.video_id = fs_course_answer_logs.video_id
|
|
<where>
|
|
<where>
|
|
<if test="userId != null and userId != 0 ">
|
|
<if test="userId != null and userId != 0 ">
|