|
@@ -308,7 +308,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<select id="selectFsUserPageListNew" resultType="com.fs.store.vo.h5.FsUserPageListVO">
|
|
|
SELECT
|
|
|
fs_user.user_id,
|
|
|
- fs_user.nick_name,
|
|
|
+ fs_user.nickname,
|
|
|
fs_user.avatar,
|
|
|
fs_user.phone,
|
|
|
fs_user.status,
|
|
@@ -320,6 +320,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
fs_user
|
|
|
<where>
|
|
|
fs_user.is_del = 0
|
|
|
+ <if test="companyId != null">
|
|
|
+ AND fs_user.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null and companyUserId != '' ">
|
|
|
+ AND fs_user.company_user_id = #{companyUserId}
|
|
|
+ </if>
|
|
|
<if test="registerStartTime != null and registerStartTime !='' ">
|
|
|
AND fs_user.create_time >= #{registerStartTime}
|
|
|
</if>
|
|
@@ -333,13 +339,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="nickname != null and nickname != ''">
|
|
|
- AND fs_user.nick_name like concat(#{nickname},'%')
|
|
|
+ AND fs_user.nickname like concat('%', #{nickname},'%')
|
|
|
</if>
|
|
|
<if test="phone != null and phone != ''">
|
|
|
- AND fs_user.phone = #{phone}
|
|
|
- </if>
|
|
|
- <if test="companyId != null">
|
|
|
- AND fs_user.company_id = #{companyId}
|
|
|
+ AND fs_user.phone like concat('%', #{phone},'%')
|
|
|
</if>
|
|
|
</where>
|
|
|
limit ${(pageNum-1)*pageSize},${pageSize}
|
|
@@ -1106,19 +1109,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<select id="countCourseRankingByComplete" resultType="com.fs.store.vo.h5.FsCourseRankingVO">
|
|
|
SELECT
|
|
|
fcv.title AS videoName,
|
|
|
+ fcv.video_id,
|
|
|
ifnull(
|
|
|
- ROUND((
|
|
|
- COUNT( DISTINCT CASE WHEN fcc.complete_watch_count > 0 THEN 1 END ) / count(1))* 100,
|
|
|
+ ROUND(
|
|
|
+ (
|
|
|
+ COUNT( DISTINCT CASE WHEN fwl.log_type = 2 THEN fwl.log_id END ) / count( DISTINCT CASE WHEN fwl.log_type != 3 THEN fwl.log_id END )) * 100,
|
|
|
2
|
|
|
),
|
|
|
0
|
|
|
) AS completeRate
|
|
|
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_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
|
|
|
+ fs_course_watch_log fwl
|
|
|
+ LEFT JOIN fs_user ON fs_user.user_id = fwl.user_id
|
|
|
+ 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
|
|
|
+ -- 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 = fwl.video_id
|
|
|
<where>
|
|
|
<if test="userId != null and userId != 0 ">
|
|
|
AND ( fs_user.company_user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
@@ -1127,20 +1133,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
and fs_user.company_id = #{companyId}
|
|
|
</if>
|
|
|
<if test="startTime != null and startTime !='' ">
|
|
|
- AND fcc.create_time >= #{startTime}
|
|
|
+ AND fwl.create_time >= #{startTime}
|
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
- AND fcc.create_time <= #{endTime}
|
|
|
+ AND fwl.create_time <= #{endTime}
|
|
|
</if>
|
|
|
<if test="periodId != null and periodId != ''">
|
|
|
- AND fcpd.period_id = #{periodId}
|
|
|
+ AND fwl.period_id = #{periodId}
|
|
|
</if>
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
- AND fcpd.video_id = #{videoId}
|
|
|
+ AND fwl.video_id = #{videoId}
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY
|
|
|
- fcpd.video_id
|
|
|
+ fwl.video_id
|
|
|
<choose>
|
|
|
<when test="order != null and order == 'asc'">
|
|
|
ORDER BY completeRate asc
|
|
@@ -1161,7 +1167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
ifnull(
|
|
|
ROUND(
|
|
|
(
|
|
|
- COUNT( DISTINCT CASE WHEN fs_course_answer_logs.is_right = 1 THEN 1 END ) / count(1)) * 100,
|
|
|
+ COUNT( DISTINCT CASE WHEN fs_course_answer_logs.is_right = 1 THEN fs_course_answer_logs.log_id END ) / count( DISTINCT fs_course_answer_logs.log_id)) * 100,
|
|
|
2
|
|
|
),
|
|
|
0
|
|
@@ -1169,7 +1175,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
FROM
|
|
|
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
|
|
|
+ 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
|
|
|
LEFT JOIN fs_user_course_video fcv ON fcv.video_id = fs_course_answer_logs.video_id
|
|
|
<where>
|
|
|
<if test="userId != null and userId != 0 ">
|
|
@@ -1358,13 +1365,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
+
|
|
|
<select id="countUserCourse2" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
(
|
|
|
SELECT
|
|
|
- count(1)
|
|
|
+ count(DISTINCT l.user_id)
|
|
|
FROM
|
|
|
fs_course_watch_log l
|
|
|
+ LEFT JOIN fs_user on fs_user.user_id = l.user_id
|
|
|
LEFT JOIN company_user ON l.company_user_id = company_user.user_id
|
|
|
where
|
|
|
l.log_type != 3 and send_type = 1
|
|
@@ -1380,15 +1389,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND l.video_id = #{videoId}
|
|
|
</if>
|
|
|
+ <if test="startTime != null and startTime !='' ">
|
|
|
+ and l.create_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
+ and l.create_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ -- 单独通过销售id查询
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
|
- AND l.user_id = #{companyUserId}
|
|
|
+ AND l.company_user_id = #{companyUserId}
|
|
|
</if>
|
|
|
) as courseWatchNum,
|
|
|
(
|
|
|
SELECT
|
|
|
- count(1)
|
|
|
+ count(DISTINCT l.user_id)
|
|
|
FROM
|
|
|
fs_course_watch_log l
|
|
|
+ LEFT JOIN fs_user on fs_user.user_id = l.user_id
|
|
|
LEFT JOIN company_user ON l.company_user_id = company_user.user_id
|
|
|
where
|
|
|
l.log_type = 2 and send_type = 1
|
|
@@ -1404,10 +1421,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="videoId != null and videoId != ''">
|
|
|
AND l.video_id = #{videoId}
|
|
|
</if>
|
|
|
+ <if test="startTime != null and startTime !='' ">
|
|
|
+ and l.create_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
+ and l.create_time <= #{endTime}
|
|
|
+ </if>
|
|
|
-- 单独通过销售id查询
|
|
|
<if test="companyUserId != null and companyUserId != ''">
|
|
|
- AND l.user_id = #{companyUserId}
|
|
|
+ AND l.company_user_id = #{companyUserId}
|
|
|
</if>
|
|
|
) as courseCompleteNum
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="countCourseDetailsNew" resultType="Map">
|
|
|
+ SELECT
|
|
|
+ count( DISTINCT l.period_id ) as courseNum,
|
|
|
+ count( DISTINCT l.video_id ) as videoNum,
|
|
|
+ count( DISTINCT l.user_id ) as courseUserNum
|
|
|
+ FROM
|
|
|
+ fs_course_watch_log l
|
|
|
+ left join fs_user on fs_user.user_id = l.user_id
|
|
|
+ LEFT JOIN company_user ON l.company_user_id = company_user.user_id
|
|
|
+ WHERE
|
|
|
+ l.log_type != 3
|
|
|
+ AND send_type = 1
|
|
|
+ <if test="userId != null and userId != 0 ">
|
|
|
+ AND l.company_user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId == 0 ">
|
|
|
+ and l.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test="periodId != null and periodId != ''">
|
|
|
+ AND l.period_id = #{periodId}
|
|
|
+ </if>
|
|
|
+ <if test="videoId != null and videoId != ''">
|
|
|
+ AND l.video_id = #{videoId}
|
|
|
+ </if>
|
|
|
+ -- 单独通过销售id查询
|
|
|
+ <if test="companyUserId != null and companyUserId != ''">
|
|
|
+ AND l.company_user_id = #{companyUserId}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|