|
@@ -618,9 +618,13 @@
|
|
|
fs_user
|
|
|
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
|
|
|
- WHERE
|
|
|
- (company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
- and fs_user.is_del = 0
|
|
|
+ WHERE fs_user.is_del = 0
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ and (fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
GROUP BY
|
|
|
fs_user.`status`
|
|
|
</select>
|
|
@@ -640,8 +644,14 @@
|
|
|
|
|
|
<select id="getCountWatchCourse" resultType="UserDetailsVO">
|
|
|
SELECT
|
|
|
- ifnull( complete_watch_count, 0 ) AS completeWatchCount ,
|
|
|
- ifnull( watch_times, 0 ) AS watchTimes,
|
|
|
+ <if test="dateTag == null or dateTag =='' ">
|
|
|
+ ifnull( sum(complete_watch_count), 0 ) AS completeWatchCount ,
|
|
|
+ ifnull( sum(watch_times), 0 ) AS watchTimes,
|
|
|
+ </if>
|
|
|
+ <if test="dateTag != null and dateTag !='' ">
|
|
|
+ ifnull( complete_watch_count, 0 ) AS completeWatchCount ,
|
|
|
+ ifnull( watch_times, 0 ) AS watchTimes,
|
|
|
+ </if>
|
|
|
fs_user.user_id
|
|
|
FROM
|
|
|
fs_user_course_count
|
|
@@ -664,11 +674,10 @@
|
|
|
</when>
|
|
|
</choose>
|
|
|
</if>
|
|
|
+ and fs_user.user_id = #{fsUserId}
|
|
|
</where>
|
|
|
GROUP BY
|
|
|
fs_user.user_id
|
|
|
- HAVING
|
|
|
- fs_user.user_id = #{fsUserId}
|
|
|
</select>
|
|
|
|
|
|
<select id="getCountAnswer" resultType="UserDetailsVO">
|
|
@@ -680,8 +689,8 @@
|
|
|
fs_course_answer_logs
|
|
|
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
|
|
|
- WHERE
|
|
|
- (company_user.user_id = #{userId} or company_user.parent_id = #{userId} )
|
|
|
+ <where>
|
|
|
+
|
|
|
<if test="dateTag != null and dateTag !='' ">
|
|
|
<choose>
|
|
|
<when test = "dateTag == '今天'">
|
|
@@ -698,10 +707,10 @@
|
|
|
</when>
|
|
|
</choose>
|
|
|
</if>
|
|
|
+ and fs_user.user_id = #{fsUserId}
|
|
|
+ </where>
|
|
|
GROUP BY
|
|
|
fs_user.user_id
|
|
|
- HAVING
|
|
|
- fs_user.user_id = #{fsUserId}
|
|
|
) AS answerTime,
|
|
|
(
|
|
|
SELECT
|
|
@@ -710,9 +719,8 @@
|
|
|
fs_course_answer_logs
|
|
|
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
|
|
|
- WHERE
|
|
|
- (company_user.user_id = #{userId} or company_user.parent_id = #{userId} )
|
|
|
- AND fs_course_answer_logs.is_right = 1
|
|
|
+ <where>
|
|
|
+ fs_course_answer_logs.is_right = 1
|
|
|
<if test="dateTag != null and dateTag !='' ">
|
|
|
<choose>
|
|
|
<when test = "dateTag == '今天'">
|
|
@@ -729,10 +737,10 @@
|
|
|
</when>
|
|
|
</choose>
|
|
|
</if>
|
|
|
+ and fs_user.user_id = #{fsUserId}
|
|
|
+ </where>
|
|
|
GROUP BY
|
|
|
fs_user.user_id
|
|
|
- HAVING
|
|
|
- fs_user.user_id = #{fsUserId}
|
|
|
) AS answerRightTime;
|
|
|
</select>
|
|
|
|
|
@@ -745,9 +753,8 @@
|
|
|
fs_course_red_packet_log
|
|
|
LEFT JOIN fs_user ON fs_user.user_id = fs_course_red_packet_log.user_id
|
|
|
LEFT JOIN company_user ON company_user.user_id = fs_user.company_user_id
|
|
|
- WHERE
|
|
|
- (company_user.user_id = #{userId} or company_user.parent_id = #{userId} )
|
|
|
- and fs_course_red_packet_log.status = 1
|
|
|
+ <where>
|
|
|
+ fs_course_red_packet_log.status = 1
|
|
|
<if test="dateTag != null and dateTag !='' ">
|
|
|
<choose>
|
|
|
<when test = "dateTag == '今天'">
|
|
@@ -764,10 +771,10 @@
|
|
|
</when>
|
|
|
</choose>
|
|
|
</if>
|
|
|
+ and fs_user.user_id = #{fsUserId}
|
|
|
+ </where>
|
|
|
GROUP BY
|
|
|
fs_user.user_id
|
|
|
- HAVING
|
|
|
- fs_user.user_id = #{fsUserId}
|
|
|
</select>
|
|
|
|
|
|
<select id="getUserVipCountByCompanyUserId" resultType="java.util.Map">
|
|
@@ -790,15 +797,24 @@
|
|
|
SELECT (SELECT count(fs_user.user_id)
|
|
|
FROM fs_user
|
|
|
LEFT JOIN company_user ON fs_user.company_user_id = company_user.user_id
|
|
|
- WHERE (
|
|
|
- company_user.user_id = #{userId}
|
|
|
- OR company_user.parent_id = #{userId}
|
|
|
- ) and fs_user.is_del = 0) as userTotal,
|
|
|
+ WHERE fs_user.is_del = 0
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ and (fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ ) as userTotal,
|
|
|
(SELECT count(fs_user.user_id)
|
|
|
FROM fs_user
|
|
|
LEFT JOIN company_user ON fs_user.company_user_id = company_user.user_id
|
|
|
- WHERE (company_user.user_id = #{userId} OR company_user.parent_id = #{userId})
|
|
|
- and fs_user.is_del = 0
|
|
|
+ WHERE fs_user.is_del = 0
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ and (fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
AND to_days(fs_user.create_time) = to_days(now())) as todayNewUser
|
|
|
</select>
|
|
|
|
|
@@ -811,7 +827,15 @@
|
|
|
LEFT JOIN fs_user ON fs_user.user_id = company_tag_user.user_id
|
|
|
LEFT JOIN company_tag ON FIND_IN_SET( company_tag.tag_id, company_tag_user.tag_ids ) > 0
|
|
|
LEFT JOIN company_user ON fs_user.company_user_id = company_user.user_id
|
|
|
- where (company_user.user_id = #{userId} or company_user.parent_id = #{userId} ) and company_tag.tag_id is not null
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ and (fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ and company_tag.tag_id is not null
|
|
|
+ </where>
|
|
|
GROUP BY
|
|
|
company_tag.tag_id
|
|
|
</select>
|
|
@@ -826,8 +850,13 @@
|
|
|
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
|
|
|
- WHERE
|
|
|
- ( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ and (fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
|
and fcc.create_time >= #{startTime}
|
|
|
</if>
|
|
@@ -844,7 +873,7 @@
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
|
AND company_user.user_id = #{companyUserId}
|
|
|
</if>
|
|
|
-
|
|
|
+ </where>
|
|
|
) as courseWatchNum,
|
|
|
(
|
|
|
SELECT
|
|
@@ -854,8 +883,13 @@
|
|
|
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
|
|
|
- WHERE
|
|
|
- ( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ and (fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
AND fcc.complete_watch_count > 0
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
|
and fcc.create_time >= #{startTime}
|
|
@@ -873,6 +907,7 @@
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
|
AND company_user.user_id = #{companyUserId}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
) as courseCompleteNum
|
|
|
</select>
|
|
|
|
|
@@ -885,8 +920,13 @@
|
|
|
fs_course_answer_logs
|
|
|
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
|
|
|
- WHERE
|
|
|
- ( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ and (fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
|
AND fs_course_answer_logs.create_time >= #{startTime}
|
|
|
</if>
|
|
@@ -903,6 +943,7 @@
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
|
AND company_user.user_id = #{companyUserId}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
) AS answerNum,
|
|
|
(
|
|
|
SELECT
|
|
@@ -911,8 +952,13 @@
|
|
|
fs_course_answer_logs
|
|
|
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
|
|
|
- WHERE
|
|
|
- ( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ and (fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
AND fs_course_answer_logs.is_right = 1
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
|
AND fs_course_answer_logs.create_time >= #{startTime}
|
|
@@ -930,6 +976,7 @@
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
|
AND company_user.user_id = #{companyUserId}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
) AS answerRightNum
|
|
|
</select>
|
|
|
|
|
@@ -942,8 +989,13 @@
|
|
|
fs_course_red_packet_log flog
|
|
|
LEFT JOIN fs_user ON fs_user.user_id = flog.user_id
|
|
|
LEFT JOIN company_user ON company_user.user_id = fs_user.company_user_id
|
|
|
- WHERE
|
|
|
- ( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ and (fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
|
AND flog.create_time >= #{startTime}
|
|
|
</if>
|
|
@@ -960,6 +1012,7 @@
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
|
AND company_user.user_id = #{companyUserId}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
) AS redPacketNum,
|
|
|
(
|
|
|
SELECT
|
|
@@ -968,8 +1021,13 @@
|
|
|
fs_course_red_packet_log flog
|
|
|
LEFT JOIN fs_user ON fs_user.user_id = flog.user_id
|
|
|
LEFT JOIN company_user ON company_user.user_id = fs_user.company_user_id
|
|
|
- WHERE
|
|
|
- ( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ and (fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
|
AND flog.create_time >= #{startTime}
|
|
|
</if>
|
|
@@ -986,6 +1044,7 @@
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
|
AND company_user.user_id = #{companyUserId}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
) AS redPacketAmount
|
|
|
</select>
|
|
|
|
|
@@ -999,9 +1058,12 @@
|
|
|
LEFT JOIN fs_user ON fs_user.user_id = fcc.user_id
|
|
|
WHERE 1=1
|
|
|
AND FIND_IN_SET(#{companyId}, fpd.company_id)
|
|
|
- <if test="userId != null and userId != ''">
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
AND fs_user.company_user_id = #{userId}
|
|
|
</if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
<if test="periodId != null and periodId != ''">
|
|
|
AND fcpd.period_id = #{periodId}
|
|
|
</if>
|
|
@@ -1018,9 +1080,12 @@
|
|
|
LEFT JOIN fs_user ON fs_user.user_id = fcc.user_id
|
|
|
WHERE 1=1
|
|
|
AND FIND_IN_SET(#{companyId}, fpd.company_id)
|
|
|
- <if test="userId != null and userId != ''">
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
AND fs_user.company_user_id = #{userId}
|
|
|
</if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
<if test="periodId != null and periodId != ''">
|
|
|
AND fcpd.period_id = #{periodId}
|
|
|
</if>
|
|
@@ -1047,9 +1112,12 @@
|
|
|
AND fs_user.company_user_id = #{companyUserId}
|
|
|
</if>
|
|
|
<where>
|
|
|
- <if test="userId != null and userId != ''">
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
AND fs_user.company_user_id = #{userId}
|
|
|
</if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
) as courseUserNum
|
|
|
</select>
|
|
@@ -1065,8 +1133,13 @@
|
|
|
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
|
|
|
- WHERE
|
|
|
- ( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ AND ( fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
|
AND fcc.create_time >= #{startTime}
|
|
|
</if>
|
|
@@ -1079,6 +1152,7 @@
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND fcpd.video_id = #{videoId}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
group by fcc.user_id
|
|
|
<choose>
|
|
|
<when test="order != null and order == 'asc'">
|
|
@@ -1105,8 +1179,13 @@
|
|
|
fs_course_answer_logs
|
|
|
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
|
|
|
- WHERE
|
|
|
- ( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ AND ( fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
|
AND fs_course_answer_logs.create_time >= #{startTime}
|
|
|
</if>
|
|
@@ -1119,6 +1198,7 @@
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND fs_course_answer_logs.video_id = #{videoId}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
group by fs_user.user_id
|
|
|
<choose>
|
|
|
<when test="order != null and order == 'asc'">
|
|
@@ -1150,8 +1230,13 @@
|
|
|
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
|
|
|
- WHERE
|
|
|
- ( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ AND ( fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
|
AND fcc.create_time >= #{startTime}
|
|
|
</if>
|
|
@@ -1164,6 +1249,7 @@
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND fcpd.video_id = #{videoId}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
GROUP BY
|
|
|
fcpd.video_id
|
|
|
<choose>
|
|
@@ -1196,8 +1282,13 @@
|
|
|
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_course_video fcv ON fcv.video_id = fs_course_answer_logs.video_id
|
|
|
- WHERE
|
|
|
- ( company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ <where>
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ AND ( fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
|
AND fs_course_answer_logs.create_time >= #{startTime}
|
|
|
</if>
|
|
@@ -1210,6 +1301,7 @@
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND fs_course_answer_logs.video_id = #{videoId}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
GROUP BY
|
|
|
fs_course_answer_logs.video_id
|
|
|
<choose>
|
|
@@ -1245,14 +1337,20 @@
|
|
|
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
|
|
|
- WHERE
|
|
|
- company_user.user_id = #{companyUserId}
|
|
|
+ <where>
|
|
|
+ <if test="companyUserId != null and companyUserId != 0 ">
|
|
|
+ AND fs_user.company_user_id = #{companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null and companyUserId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
<if test="periodId != null and periodId != ''">
|
|
|
AND fcpd.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND fcpd.video_id = #{videoId}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
GROUP BY
|
|
|
fcpd.video_id
|
|
|
</select>
|
|
@@ -1268,8 +1366,11 @@
|
|
|
LEFT JOIN fs_user ON fs_user.user_id = flog.user_id
|
|
|
LEFT JOIN company_user ON company_user.user_id = fs_user.company_user_id
|
|
|
<where>
|
|
|
- <if test="companyUserId != null and companyUserId !='' ">
|
|
|
- AND company_user.user_id = #{companyUserId}
|
|
|
+ <if test="companyUserId != null and companyUserId != 0 ">
|
|
|
+ AND fs_user.company_user_id = #{companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null and companyUserId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
</if>
|
|
|
<if test="periodId != null and periodId != ''">
|
|
|
AND flog.period_id = #{periodId}
|
|
@@ -1309,8 +1410,11 @@
|
|
|
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
|
|
|
<where>
|
|
|
- <if test="companyUserId != null and companyUserId !='' ">
|
|
|
- AND company_user.user_id = #{companyUserId}
|
|
|
+ <if test="companyUserId != null and companyUserId != 0 ">
|
|
|
+ AND fs_user.company_user_id = #{companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null and companyUserId == 0 ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
</if>
|
|
|
<if test="periodId != null and periodId != ''">
|
|
|
AND fs_course_answer_logs.period_id = #{periodId}
|
|
@@ -1334,7 +1438,14 @@
|
|
|
SELECT
|
|
|
(
|
|
|
SELECT count( fs_user.user_id ) FROM fs_user LEFT JOIN company_user ON fs_user.company_user_id = company_user.user_id
|
|
|
- WHERE company_user.user_id = #{companyUserId}
|
|
|
+ <where>
|
|
|
+ <if test="companyUserId != null and companyUserId != '' and companyUserId != '0' ">
|
|
|
+ AND fs_user.company_user_id = #{companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null and companyUserId != '' and companyUserId == '0' ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
) AS userTotal,
|
|
|
(
|
|
|
SELECT
|
|
@@ -1342,11 +1453,17 @@
|
|
|
FROM
|
|
|
fs_user
|
|
|
LEFT JOIN company_user ON fs_user.company_user_id = company_user.user_id
|
|
|
- WHERE
|
|
|
- company_user.user_id = #{companyUserId}
|
|
|
+ <where>
|
|
|
+ <if test="companyUserId != null and companyUserId != '' and companyUserId != '0' ">
|
|
|
+ AND fs_user.company_user_id = #{companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null and companyUserId != '' and companyUserId == '0' ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
and fs_user.is_del = 0
|
|
|
AND to_days( fs_user.create_time ) = to_days(
|
|
|
now())
|
|
|
+ </where>
|
|
|
) AS todayNewUser
|
|
|
</select>
|
|
|
|
|
@@ -1357,8 +1474,14 @@
|
|
|
FROM
|
|
|
fs_course_red_packet_log flog
|
|
|
LEFT JOIN fs_user ON fs_user.user_id = flog.user_id
|
|
|
- WHERE
|
|
|
- fs_user.company_user_id = #{companyUserId}
|
|
|
+ <where>
|
|
|
+ <if test="companyUserId != null and companyUserId != '' and companyUserId != '0' ">
|
|
|
+ AND fs_user.company_user_id = #{companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null and companyUserId != '' and companyUserId == '0' ">
|
|
|
+ and fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectFsUserPageListCount" resultType="java.lang.Long">
|