|
@@ -788,7 +788,7 @@
|
|
|
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_video fcv ON fcv.course_id = fcc.course_id
|
|
|
+ LEFT JOIN fs_user_course_period_days fcpd ON FIND_IN_SET(fcpd.period_id, fcc.course_ids) > 0
|
|
|
WHERE
|
|
|
( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
@@ -797,14 +797,11 @@
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
and fcc.create_time <= #{endTime}
|
|
|
</if>
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fcc.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fcpd.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
- AND fcv.video_id = #{videoId}
|
|
|
- </if>
|
|
|
- <if test="videoId != null and videoId != ''">
|
|
|
- AND fcv.video_id = #{videoId}
|
|
|
+ AND fcpd.video_id = #{videoId}
|
|
|
</if>
|
|
|
-- 单独通过销售id查询
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
@@ -819,7 +816,7 @@
|
|
|
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_video fcv ON fcv.course_id = fcc.course_id
|
|
|
+ LEFT JOIN fs_user_course_period_days fcpd ON FIND_IN_SET(fcpd.period_id, fcc.course_ids) > 0
|
|
|
WHERE
|
|
|
( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
AND fcc.complete_watch_count > 0
|
|
@@ -829,11 +826,11 @@
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
and fcc.create_time <= #{endTime}
|
|
|
</if>
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fcc.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fcpd.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
- AND fcv.video_id = #{videoId}
|
|
|
+ AND fcpd.video_id = #{videoId}
|
|
|
</if>
|
|
|
-- 单独通过销售id查询
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
@@ -859,8 +856,8 @@
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
AND fs_course_answer_logs.create_time <= #{endTime}
|
|
|
</if>
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fs_course_answer_logs.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fs_course_answer_logs.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND fs_course_answer_logs.video_id = #{videoId}
|
|
@@ -886,8 +883,8 @@
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
AND fs_course_answer_logs.create_time <= #{endTime}
|
|
|
</if>
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fs_course_answer_logs.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fs_course_answer_logs.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND fs_course_answer_logs.video_id = #{videoId}
|
|
@@ -916,8 +913,8 @@
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
AND flog.create_time <= #{endTime}
|
|
|
</if>
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND flog.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND flog.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND flog.video_id = #{videoId}
|
|
@@ -942,8 +939,8 @@
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
AND flog.create_time <= #{endTime}
|
|
|
</if>
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND flog.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND flog.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND flog.video_id = #{videoId}
|
|
@@ -956,14 +953,17 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="countCourseDetails" resultType="Map">
|
|
|
- select (SELECT count(DISTINCT fc.course_id)
|
|
|
- FROM fs_user_course fc
|
|
|
- LEFT JOIN fs_user_course_count fcc ON fcc.course_id = fc.course_id
|
|
|
+ select (SELECT
|
|
|
+ count( DISTINCT fcpd.period_id )
|
|
|
+ FROM
|
|
|
+ fs_user_course_period_days fcpd
|
|
|
+ LEFT JOIN fs_user_course_period fpd on fpd.period_id = fcpd.period_id
|
|
|
+ LEFT JOIN fs_user_course_count fcc ON FIND_IN_SET( fcpd.period_id, fcc.course_ids ) > 0
|
|
|
LEFT JOIN fs_user ON fs_user.user_id = fcc.user_id
|
|
|
- WHERE fc.is_del = 0
|
|
|
- AND FIND_IN_SET(#{companyId}, fc.company_ids)
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fc.course_id = #{courseId}
|
|
|
+ WHERE 1=1
|
|
|
+ AND FIND_IN_SET(#{companyId}, fpd.company_id)
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fcpd.period_id = #{periodId}
|
|
|
</if>
|
|
|
-- 单独通过销售id查询
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
@@ -971,32 +971,33 @@
|
|
|
</if>
|
|
|
) as courseNum,
|
|
|
|
|
|
- (SELECT count(DISTINCT fcv.video_id)
|
|
|
- FROM fs_user_course_video fcv
|
|
|
- LEFT JOIN fs_user_course fc ON fc.course_id = fcv.course_id
|
|
|
- LEFT JOIN fs_user_course_count fcc ON fcc.course_id = fc.course_id
|
|
|
+ (SELECT count(DISTINCT fcpd.video_id)
|
|
|
+ FROM fs_user_course_period_days fcpd
|
|
|
+ LEFT JOIN fs_user_course_period fpd on fpd.period_id = fcpd.period_id
|
|
|
+ LEFT JOIN fs_user_course_count fcc ON FIND_IN_SET( fcpd.period_id, fcc.course_ids ) > 0
|
|
|
LEFT JOIN fs_user ON fs_user.user_id = fcc.user_id
|
|
|
- WHERE fc.is_del = 0
|
|
|
- AND FIND_IN_SET(#{companyId}, fc.company_ids)
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fcv.course_id = #{courseId}
|
|
|
+ WHERE 1=1
|
|
|
+ AND FIND_IN_SET(#{companyId}, fpd.company_id)
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fcpd.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
- AND fcv.video_id = #{videoId}
|
|
|
+ AND fcpd.video_id = #{videoId}
|
|
|
</if>
|
|
|
-- 单独通过销售id查询
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
|
AND fs_user.company_user_id = #{companyUserId}
|
|
|
</if>
|
|
|
) as videoNum,
|
|
|
+
|
|
|
( SELECT count(DISTINCT fs_user.user_id ) FROM fs_user_course_count fcc
|
|
|
- LEFT JOIN fs_user_course_video fcv ON fcv.course_id = fcc.course_id
|
|
|
+ LEFT JOIN fs_user_course_period_days fcpd ON FIND_IN_SET( fcpd.period_id, fcc.course_ids ) > 0
|
|
|
LEFT JOIN fs_user ON fs_user.user_id = fcc.user_id
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fcc.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fcpd.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
- AND fcv.video_id = #{videoId}
|
|
|
+ AND fcpd.video_id = #{videoId}
|
|
|
</if>
|
|
|
-- 单独通过销售id查询
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
@@ -1015,7 +1016,7 @@
|
|
|
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_video fcv ON fcv.course_id = fcc.course_id
|
|
|
+ LEFT JOIN fs_user_course_period_days fcpd ON FIND_IN_SET( fcpd.period_id, fcc.course_ids ) > 0
|
|
|
WHERE
|
|
|
( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
@@ -1024,11 +1025,11 @@
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
AND fcc.create_time <= #{endTime}
|
|
|
</if>
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fcc.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fcpd.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
- AND fcv.video_id = #{videoId}
|
|
|
+ AND fcpd.video_id = #{videoId}
|
|
|
</if>
|
|
|
group by fcc.user_id
|
|
|
<choose>
|
|
@@ -1064,8 +1065,8 @@
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
AND fs_course_answer_logs.create_time <= #{endTime}
|
|
|
</if>
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fs_course_answer_logs.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fs_course_answer_logs.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND fs_course_answer_logs.video_id = #{videoId}
|
|
@@ -1099,7 +1100,8 @@
|
|
|
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_video fcv ON fcv.course_id = fcc.course_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
|
|
|
WHERE
|
|
|
( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
@@ -1108,14 +1110,14 @@
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
AND fcc.create_time <= #{endTime}
|
|
|
</if>
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fcc.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fcpd.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
- AND fcv.video_id = #{videoId}
|
|
|
+ AND fcpd.video_id = #{videoId}
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
- fcv.video_id
|
|
|
+ fcpd.video_id
|
|
|
<choose>
|
|
|
<when test="order != null and order == 'asc'">
|
|
|
ORDER BY completeRate asc
|
|
@@ -1154,8 +1156,8 @@
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
AND fs_course_answer_logs.create_time <= #{endTime}
|
|
|
</if>
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fs_course_answer_logs.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fs_course_answer_logs.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND fs_course_answer_logs.video_id = #{videoId}
|
|
@@ -1189,23 +1191,22 @@
|
|
|
),
|
|
|
0
|
|
|
) as completeRate,
|
|
|
- fcv.video_id
|
|
|
+ fcpd.video_id
|
|
|
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_video fcv ON fcv.course_id = fcc.course_id
|
|
|
+ LEFT JOIN fs_user_course_period_days fcpd ON FIND_IN_SET( fcpd.period_id, fcc.course_ids ) > 0
|
|
|
WHERE
|
|
|
company_user.user_id = #{companyUserId}
|
|
|
- and fcv.is_del = 0
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fcc.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fcpd.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
- AND fcv.video_id = #{videoId}
|
|
|
+ AND fcpd.video_id = #{videoId}
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
- fcv.video_id
|
|
|
+ fcpd.video_id
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询某用户的课程视频,红包统计 -->
|
|
@@ -1220,8 +1221,8 @@
|
|
|
LEFT JOIN company_user ON company_user.user_id = fs_user.company_user_id
|
|
|
WHERE
|
|
|
company_user.user_id = #{companyUserId}
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND flog.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND flog.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND flog.video_id = #{videoId}
|
|
@@ -1250,8 +1251,8 @@
|
|
|
LEFT JOIN company_user ON company_user.user_id = fs_user.company_user_id
|
|
|
WHERE
|
|
|
company_user.user_id = #{companyUserId}
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND fs_course_answer_logs.course_id = #{courseId}
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND fs_course_answer_logs.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND fs_course_answer_logs.video_id = #{videoId}
|