|
@@ -762,11 +762,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
count(distinct fcal.log_id) answerTime,
|
|
count(distinct fcal.log_id) answerTime,
|
|
|
count(distinct if(fcal.is_right = 1, fcal.log_id, null)) answerRightTime,
|
|
count(distinct if(fcal.is_right = 1, fcal.log_id, null)) answerRightTime,
|
|
|
count(distinct fcrpl.log_id) answerRedPacketTime,
|
|
count(distinct fcrpl.log_id) answerRedPacketTime,
|
|
|
- sum(ifnull((
|
|
|
|
|
- select sum(frp.amount)
|
|
|
|
|
- from fs_course_red_packet_log frp
|
|
|
|
|
- where frp.watch_log_id = fcwl.log_id and frp.status = 1
|
|
|
|
|
- ), 0)) answerRedPacketAmount
|
|
|
|
|
|
|
+ (
|
|
|
|
|
+ select sum(pl.amount) from fs_course_watch_log wl
|
|
|
|
|
+ inner join fs_user_company_user cu on wl.user_id = cu.user_id and wl.project = cu.project_id and wl.company_user_id = cu.company_user_id
|
|
|
|
|
+ inner join fs_course_red_packet_log pl on wl.log_id = pl.watch_log_id and pl.`status`= 1
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="dateTag != null and dateTag !='' ">
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test = "dateTag == '今天'">
|
|
|
|
|
+ and to_days(wl.create_time) = to_days(now())
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test = "dateTag == '昨天'">
|
|
|
|
|
+ and wl.create_time >= CURDATE() - INTERVAL 1 DAY AND wl.create_time < CURDATE()
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test = "dateTag == '前天'">
|
|
|
|
|
+ and wl.create_time >= CURDATE() - INTERVAL 2 DAY AND wl.create_time < CURDATE() - INTERVAL 1 DAY
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test = "dateTag == '近七天'">
|
|
|
|
|
+ and wl.create_time >= CURDATE() - INTERVAL 7 DAY
|
|
|
|
|
+ </when>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ and wl.user_id = #{fsUserId} and wl.company_user_id = #{userId}
|
|
|
|
|
+ <if test="userCompanyId!=null">
|
|
|
|
|
+ and cu.id = #{userCompanyId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ ) answerRedPacketAmount
|
|
|
FROM fs_course_watch_log fcwl
|
|
FROM fs_course_watch_log fcwl
|
|
|
inner join fs_user_company_user fucu on fcwl.user_id = fucu.user_id and fcwl.project = fucu.project_id and fcwl.company_user_id = fucu.company_user_id
|
|
inner join fs_user_company_user fucu on fcwl.user_id = fucu.user_id and fcwl.project = fucu.project_id and fcwl.company_user_id = fucu.company_user_id
|
|
|
left join fs_course_answer_logs fcal on fcal.watch_log_id = fcwl.log_id
|
|
left join fs_course_answer_logs fcal on fcal.watch_log_id = fcwl.log_id
|