|
|
@@ -1430,38 +1430,10 @@ FROM
|
|
|
c.company_id AS companyId,
|
|
|
c.company_name AS companyName
|
|
|
FROM company c
|
|
|
- <choose>
|
|
|
- <!-- 当传了 trainingCampId 时 -->
|
|
|
- <when test="trainingCampId != null">
|
|
|
- INNER JOIN fs_course_watch_log w ON c.company_id = w.company_id
|
|
|
- INNER JOIN fs_user_course_period p ON w.period_id = p.period_id AND p.training_camp_id = #{trainingCampId}
|
|
|
- </when>
|
|
|
- <!-- 当传了 periodId 时 -->
|
|
|
- <when test="periodId != null">
|
|
|
- INNER JOIN fs_course_watch_log w ON c.company_id = w.company_id AND w.period_id = #{periodId}
|
|
|
- </when>
|
|
|
- <!-- 当只传了时间范围时 -->
|
|
|
- <when test="(trainingCampId == null and periodId == null) and (sTime != null and eTime != null)">
|
|
|
- INNER JOIN fs_course_watch_log w ON c.company_id = w.company_id
|
|
|
- </when>
|
|
|
-<!-- <!– 默认情况:必须有关联记录 –>-->
|
|
|
-<!-- <otherwise>-->
|
|
|
-<!-- INNER JOIN fs_course_watch_log w ON c.company_id = w.company_id-->
|
|
|
-<!-- </otherwise>-->
|
|
|
- </choose>
|
|
|
<where>
|
|
|
<if test="companyId != null and companyId != ''">
|
|
|
AND c.company_id = #{companyId}
|
|
|
</if>
|
|
|
- <if test="(trainingCampId == null and periodId == null) and (sTime != null and eTime != null)">
|
|
|
- AND Date(w.create_time) BETWEEN #{sTime} AND #{eTime}
|
|
|
- </if>
|
|
|
- <if test="trainingCampId != null and (sTime != null and eTime != null)">
|
|
|
- AND Date(w.create_time) BETWEEN #{sTime} AND #{eTime}
|
|
|
- </if>
|
|
|
- <if test="periodId != null and (sTime != null and eTime != null)">
|
|
|
- AND Date(w.create_time) BETWEEN #{sTime} AND #{eTime}
|
|
|
- </if>
|
|
|
</where>
|
|
|
GROUP BY c.company_id, c.company_name
|
|
|
ORDER BY c.create_time DESC
|
|
|
@@ -1486,8 +1458,8 @@ FROM
|
|
|
COUNT(DISTINCT user_id) AS accessCount
|
|
|
FROM fs_course_watch_log
|
|
|
<where>
|
|
|
- <if test="sTime != null and eTime != null">
|
|
|
- AND Date(create_time) BETWEEN #{sTime} AND #{eTime}
|
|
|
+ <if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
|
|
|
+ AND create_time >= #{startDate} AND create_time < DATE_ADD(#{endDate}, INTERVAL 1 DAY)
|
|
|
</if>
|
|
|
<choose>
|
|
|
<!-- 公司维度筛选 -->
|
|
|
@@ -1542,8 +1514,8 @@ FROM
|
|
|
FROM fs_course_answer_logs a
|
|
|
INNER JOIN fs_course_watch_log w ON a.watch_log_id = w.log_id
|
|
|
<where>
|
|
|
- <if test="sTime != null and eTime != null">
|
|
|
- AND Date(w.create_time) BETWEEN #{sTime} AND #{eTime}
|
|
|
+ <if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
|
|
|
+ AND w.create_time >= #{startDate} AND w.create_time < DATE_ADD(#{endDate}, INTERVAL 1 DAY)
|
|
|
</if>
|
|
|
<choose>
|
|
|
<!-- 公司维度筛选 -->
|
|
|
@@ -1600,8 +1572,8 @@ FROM
|
|
|
INNER JOIN fs_course_watch_log w ON rpl.watch_log_id = w.log_id
|
|
|
<where>
|
|
|
rpl.status=1
|
|
|
- <if test="sTime != null and eTime != null">
|
|
|
- AND DATE(w.create_time) BETWEEN #{sTime} AND #{eTime}
|
|
|
+ <if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
|
|
|
+ AND w.create_time >= #{startDate} AND w.create_time < DATE_ADD(#{endDate}, INTERVAL 1 DAY)
|
|
|
</if>
|
|
|
<choose>
|
|
|
<!-- 公司维度筛选 -->
|