|
|
@@ -128,64 +128,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
|
|
|
- <!-- 重粉看课:仅展示同一粉丝在同一项目下、由至少两个不同企微员工产生过绑定/看课记录的数据 -->
|
|
|
+ <!-- 重粉看课:查询 fs_course_watch_log 企微发课记录(send_type=2),与课程进度口径一致 -->
|
|
|
<select id="getWatchLogList" resultType="com.fs.course.vo.UserWatchLogListVo">
|
|
|
select
|
|
|
- a.*,
|
|
|
- b.nick_name fsUserName,
|
|
|
- c.dict_label projectName,
|
|
|
- e.course_name,
|
|
|
- g.qw_user_name,
|
|
|
- f.title videoName,
|
|
|
- qc.corp_name,
|
|
|
- qc.corp_id AS corpId
|
|
|
- from
|
|
|
- fs_user_company_bind a
|
|
|
- inner join (
|
|
|
- select fs_user_id, project_id
|
|
|
- from fs_user_company_bind
|
|
|
- where project_id is not null
|
|
|
- and qw_user_id is not null
|
|
|
- <if test="fsUserId != null">
|
|
|
- and fs_user_id = #{fsUserId}
|
|
|
- </if>
|
|
|
- <if test="fsUserId == null and externalUserId != null">
|
|
|
- and fs_user_id in (
|
|
|
- select u.fs_user_id from fs_user_company_bind u
|
|
|
- where u.qw_external_contact_id = #{externalUserId}
|
|
|
- and u.fs_user_id is not null
|
|
|
- )
|
|
|
- </if>
|
|
|
- group by fs_user_id, project_id
|
|
|
- having count(distinct qw_user_id) >= 2
|
|
|
- ) dup_proj on dup_proj.fs_user_id = a.fs_user_id and dup_proj.project_id = a.project_id
|
|
|
- left join fs_user b on a.fs_user_id = b.user_id
|
|
|
- left join sys_dict_data c on c.dict_type = 'sys_course_project' and dict_value = a.project_id
|
|
|
- left join fs_user_course e on a.course_id = e.course_id
|
|
|
- left join fs_user_course_video f on a.video_id = f.video_id
|
|
|
- left join qw_user g on g.id = a.qw_user_id
|
|
|
- left join qw_company qc on qc.id = a.qw_company_id
|
|
|
+ wl.log_id AS id,
|
|
|
+ wl.log_type AS logType,
|
|
|
+ wl.finish_time AS finishTime,
|
|
|
+ wl.update_time AS updateTime,
|
|
|
+ wl.create_time AS createTime,
|
|
|
+ u.nick_name AS fsUserName,
|
|
|
+ c.dict_label AS projectName,
|
|
|
+ uc.course_name AS courseName,
|
|
|
+ CASE
|
|
|
+ WHEN qu.qw_user_name IS NOT NULL AND qu.qw_user_name LIKE '{%' THEN JSON_UNQUOTE(JSON_EXTRACT(qu.qw_user_name, '$.name'))
|
|
|
+ ELSE qu.qw_user_name
|
|
|
+ END AS qwUserName,
|
|
|
+ f.title AS videoName,
|
|
|
+ qc.corp_name AS corpName,
|
|
|
+ qu.corp_id AS corpId
|
|
|
+ from fs_course_watch_log wl
|
|
|
+ left join fs_user u on u.user_id = wl.user_id
|
|
|
+ left join fs_user_course uc on uc.course_id = wl.course_id
|
|
|
+ left join sys_dict_data c on c.dict_type = 'sys_course_project' and c.dict_value = uc.project
|
|
|
+ left join fs_user_course_video f on f.video_id = wl.video_id
|
|
|
+ left join qw_user qu on qu.id = wl.qw_user_id
|
|
|
+ left join qw_company qc on qc.corp_id = qu.corp_id
|
|
|
<where>
|
|
|
+ and wl.send_type = 2
|
|
|
<if test="externalUserId != null">
|
|
|
- and a.qw_external_contact_id = #{externalUserId}
|
|
|
+ and wl.qw_external_contact_id = #{externalUserId}
|
|
|
</if>
|
|
|
<if test="fsUserId != null">
|
|
|
- and a.fs_user_id = #{fsUserId}
|
|
|
+ and wl.user_id = #{fsUserId}
|
|
|
</if>
|
|
|
<if test="courseId != null">
|
|
|
- and a.course_id = #{courseId}
|
|
|
+ and wl.course_id = #{courseId}
|
|
|
</if>
|
|
|
<if test="videoId != null">
|
|
|
- and a.video_id = #{videoId}
|
|
|
+ and wl.video_id = #{videoId}
|
|
|
</if>
|
|
|
<if test="equivalentProjectIds != null and equivalentProjectIds.size() > 0">
|
|
|
- and a.project_id in
|
|
|
+ and uc.project in
|
|
|
<foreach collection="equivalentProjectIds" item="pid" open="(" separator="," close=")">
|
|
|
#{pid}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
</where>
|
|
|
- order by create_time desc
|
|
|
+ order by wl.create_time desc
|
|
|
</select>
|
|
|
<delete id="deleteFsUserCompanyBindByCompanyUserIdAndFsUserId" parameterType="Long">
|
|
|
delete from fs_user_company_bind where fs_user_id=#{fsUserId} and company_user_id=#{companyUserId}
|