|
@@ -185,7 +185,121 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
where user_id = #{userId}
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectFsUserPageList" resultType="com.fs.store.vo.h5.FsUserPageListVO">
|
|
|
+ SELECT
|
|
|
+ fs_user.*,
|
|
|
+ fs_user_course_count.id,
|
|
|
+ fs_user_course_count.watch_course_count,
|
|
|
+ fs_user_course_count.miss_course_count,
|
|
|
+ fs_user_course_count.miss_course_status,
|
|
|
+ fs_user_course_count.course_ids,
|
|
|
+ fs_user_course_count.part_course_count,
|
|
|
+ fs_user_course_count.last_watch_date,
|
|
|
+ fs_user_course_count.STATUS AS courseCountStatus,
|
|
|
+ fs_user_course_count.stop_watch_days,
|
|
|
+ fs_user_course_count.complete_watch_date,
|
|
|
+ GROUP_CONCAT(DISTINCT company_tag.tag) AS tag,
|
|
|
+ GROUP_CONCAT(DISTINCT company_tag.tag_id) AS tagIds,
|
|
|
+ company_user.nick_name as companyUserNickName,
|
|
|
+ fs_user_company_user.is_repeat_fans
|
|
|
+ FROM
|
|
|
+ fs_user
|
|
|
+ LEFT JOIN fs_user_course_count ON fs_user.user_id = fs_user_course_count.user_id
|
|
|
+ LEFT JOIN company_tag_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 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 fs_user.is_del = 0
|
|
|
+ <if test="userId != null and userId !='' ">
|
|
|
+ and (company_user.user_id = #{userId} OR company_user.parent_id = #{userId} )
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null and companyUserId !='' ">
|
|
|
+ and company_user.user_id = #{companyUserId}
|
|
|
+ </if>
|
|
|
+ <choose>
|
|
|
+ <when test = "isBlack">
|
|
|
+ AND (fs_user.status = 0 or fs_user_company_user.is_repeat_fans = 1)
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND (fs_user.status = 1 and fs_user_company_user.is_repeat_fans = 0)
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="keyword != null and keyword !='' ">
|
|
|
+ AND (fs_user.nickname LIKE concat('%',#{keyword},'%')
|
|
|
+ or fs_user.phone LIKE concat('%',#{keyword},'%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="registerStartTime != null and registerStartTime !='' ">
|
|
|
+ AND fs_user.create_time >= #{registerStartTime}
|
|
|
+ </if>
|
|
|
+ <if test="registerEndTime != null and registerEndTime !='' ">
|
|
|
+ AND fs_user.create_time <= #{registerEndTime}
|
|
|
+ </if>
|
|
|
+ <if test="tagIds != null and tagIds.length > 0">
|
|
|
+ AND
|
|
|
+ <foreach collection="tagIds" item="item" index="index" open="(" separator="or" close=")">
|
|
|
+ company_tag_user.tag_ids LIKE concat('%"',#{item},'"%')
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="tabValue != null and tabValue !='' ">
|
|
|
+ <choose>
|
|
|
+ <when test = "tabValue == 1">
|
|
|
+ AND DAY(fs_user.create_time) = DAY(NOW())
|
|
|
+ </when>
|
|
|
+ <when test = "tabValue == 2">
|
|
|
+ AND DAY(fs_user_course_count.complete_watch_date) = DAY(NOW())
|
|
|
+ </when>
|
|
|
+ <when test = "tabValue == 3">
|
|
|
+ AND (fs_user_course_count.status = 3 or fs_user_course_count.status is null)
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="watchCourseType != null and watchCourseType !='' ">
|
|
|
+ <choose>
|
|
|
+ <when test = "watchCourseType == 1">
|
|
|
+ AND (fs_user_course_count.status = 3 or fs_user_course_count.status is null)
|
|
|
+ </when>
|
|
|
+ <when test = "watchCourseType == 2">
|
|
|
+ AND fs_user_course_count.status = 1
|
|
|
+ </when>
|
|
|
+ <when test = "watchCourseType == 3">
|
|
|
+ AND fs_user_course_count.status = 2
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="missCourseStatus != null and missCourseStatus !='' ">
|
|
|
+ <choose>
|
|
|
+ <when test = "missCourseStatus == 1">
|
|
|
+ AND fs_user_course_count.miss_course_status = 1
|
|
|
+ </when>
|
|
|
+ <when test = "missCourseStatus == 2">
|
|
|
+ AND (fs_user_course_count.miss_course_status = 2 or fs_user_course_count.miss_course_status is null )
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ group by fs_user.user_id
|
|
|
+
|
|
|
+ <if test="continueMissCourseSort != null and continueMissCourseSort !='' ">
|
|
|
+ order by
|
|
|
+ <choose>
|
|
|
+ <when test = "continueMissCourseSort == 0">
|
|
|
+ fs_user.create_time desc
|
|
|
+ </when>
|
|
|
+ <when test = "continueMissCourseSort == 1">
|
|
|
+ fs_user.nickname asc
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
|
|
|
+ <update id="batchUpdateFsUserByIds" parameterType="Long">
|
|
|
+ update fs_user
|
|
|
+ set status = #{status} where user_id in
|
|
|
+ <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
|
|
|
<insert id="insertFsUser" parameterType="FsUser" useGeneratedKeys="true" keyProperty="userId">
|
|
|
insert into fs_user
|