|
@@ -44,10 +44,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="secondImg" column="second_img" />
|
|
<result property="secondImg" column="second_img" />
|
|
|
<result property="companyIds" column="company_ids" />
|
|
<result property="companyIds" column="company_ids" />
|
|
|
<result property="configJson" column="config_json" />
|
|
<result property="configJson" column="config_json" />
|
|
|
|
|
+ <result property="recHomeCourseTopEnabled" column="rec_home_course_top_enabled"/>
|
|
|
|
|
+ <result property="recHomeCourseTopMode" column="rec_home_course_top_mode"/>
|
|
|
|
|
+ <result property="recHomeCourseTopSort" column="rec_home_course_top_sort"/>
|
|
|
|
|
+ <result property="recMallHomeEnabled" column="rec_mall_home_enabled"/>
|
|
|
|
|
+ <result property="recMallHomeMode" column="rec_mall_home_mode"/>
|
|
|
|
|
+ <result property="recMallHomeSort" column="rec_mall_home_sort"/>
|
|
|
|
|
+ <result property="recHomeLongVideoEnabled" column="rec_home_long_video_enabled"/>
|
|
|
|
|
+ <result property="recHomeLongVideoMode" column="rec_home_long_video_mode"/>
|
|
|
|
|
+ <result property="recHomeLongVideoSort" column="rec_home_long_video_sort"/>
|
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectFsUserCourseVo">
|
|
<sql id="selectFsUserCourseVo">
|
|
|
- select course_id,is_private,company_ids,is_next,talent_id,second_img,is_del, cate_id,sub_cate_id, course_name, title, img_url, sort, create_time, update_time, status, is_vip, is_hot, is_show, views, duration, description, hot_ranking, integral, price, sell_price, project, tags, likes, favorite_num, shares, is_auto_play, is_fast, is_best, is_tui, hot_num, is_integral, course_type, config_json from fs_user_course
|
|
|
|
|
|
|
+ select course_id,is_private,company_ids,is_next,talent_id,second_img,is_del, cate_id,sub_cate_id, course_name, title, img_url, sort, create_time, update_time, status, is_vip, is_hot, is_show, views, duration, description, hot_ranking, integral, price, sell_price, project, tags, likes, favorite_num, shares, is_auto_play, is_fast, is_best, is_tui, hot_num, is_integral, course_type, config_json,
|
|
|
|
|
+ rec_home_course_top_enabled, rec_home_course_top_mode, rec_home_course_top_sort,
|
|
|
|
|
+ rec_mall_home_enabled, rec_mall_home_mode, rec_mall_home_sort,
|
|
|
|
|
+ rec_home_long_video_enabled, rec_home_long_video_mode, rec_home_long_video_sort
|
|
|
|
|
+ from fs_user_course
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectFsUserCourseList" parameterType="FsUserCourse" resultMap="FsUserCourseResult">
|
|
<select id="selectFsUserCourseList" parameterType="FsUserCourse" resultMap="FsUserCourseResult">
|
|
@@ -84,7 +97,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="courseType != null "> and course_type = #{courseType}</if>
|
|
<if test="courseType != null "> and course_type = #{courseType}</if>
|
|
|
<if test="talentId != null "> and talent_id = #{talentId}</if>
|
|
<if test="talentId != null "> and talent_id = #{talentId}</if>
|
|
|
<if test="isNext != null "> and is_next = #{isNext}</if>
|
|
<if test="isNext != null "> and is_next = #{isNext}</if>
|
|
|
- <if test="isPrivate != null "> and is_private = #{isPrivate}</if>
|
|
|
|
|
|
|
+ <if test="isPrivate != null ">
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="isPrivate == 1"> and (is_private = 1 or is_private is null)</when>
|
|
|
|
|
+ <otherwise> and is_private = #{isPrivate}</otherwise>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ </if>
|
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
|
<if test="configJson != null "> and config_json = #{configJson}</if>
|
|
<if test="configJson != null "> and config_json = #{configJson}</if>
|
|
|
</where>
|
|
</where>
|
|
@@ -215,6 +233,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="companyIds != null">company_ids,</if>
|
|
<if test="companyIds != null">company_ids,</if>
|
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
|
<if test="configJson != null">config_json,</if>
|
|
<if test="configJson != null">config_json,</if>
|
|
|
|
|
+ <if test="recHomeCourseTopEnabled != null">rec_home_course_top_enabled,</if>
|
|
|
|
|
+ <if test="recHomeCourseTopMode != null">rec_home_course_top_mode,</if>
|
|
|
|
|
+ <if test="recHomeCourseTopSort != null">rec_home_course_top_sort,</if>
|
|
|
|
|
+ <if test="recMallHomeEnabled != null">rec_mall_home_enabled,</if>
|
|
|
|
|
+ <if test="recMallHomeMode != null">rec_mall_home_mode,</if>
|
|
|
|
|
+ <if test="recMallHomeSort != null">rec_mall_home_sort,</if>
|
|
|
|
|
+ <if test="recHomeLongVideoEnabled != null">rec_home_long_video_enabled,</if>
|
|
|
|
|
+ <if test="recHomeLongVideoMode != null">rec_home_long_video_mode,</if>
|
|
|
|
|
+ <if test="recHomeLongVideoSort != null">rec_home_long_video_sort,</if>
|
|
|
</trim>
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="cateId != null">#{cateId},</if>
|
|
<if test="cateId != null">#{cateId},</if>
|
|
@@ -255,7 +282,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="secondImg != null">#{secondImg},</if>
|
|
<if test="secondImg != null">#{secondImg},</if>
|
|
|
<if test="companyIds != null">#{companyIds},</if>
|
|
<if test="companyIds != null">#{companyIds},</if>
|
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
|
- <if test="configJson != null">config_json = #{configJson},</if>
|
|
|
|
|
|
|
+ <if test="configJson != null">#{configJson},</if>
|
|
|
|
|
+ <if test="recHomeCourseTopEnabled != null">#{recHomeCourseTopEnabled},</if>
|
|
|
|
|
+ <if test="recHomeCourseTopMode != null">#{recHomeCourseTopMode},</if>
|
|
|
|
|
+ <if test="recHomeCourseTopSort != null">#{recHomeCourseTopSort},</if>
|
|
|
|
|
+ <if test="recMallHomeEnabled != null">#{recMallHomeEnabled},</if>
|
|
|
|
|
+ <if test="recMallHomeMode != null">#{recMallHomeMode},</if>
|
|
|
|
|
+ <if test="recMallHomeSort != null">#{recMallHomeSort},</if>
|
|
|
|
|
+ <if test="recHomeLongVideoEnabled != null">#{recHomeLongVideoEnabled},</if>
|
|
|
|
|
+ <if test="recHomeLongVideoMode != null">#{recHomeLongVideoMode},</if>
|
|
|
|
|
+ <if test="recHomeLongVideoSort != null">#{recHomeLongVideoSort},</if>
|
|
|
</trim>
|
|
</trim>
|
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
|
@@ -299,6 +335,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="isPrivate != null">is_private = #{isPrivate},</if>
|
|
<if test="isPrivate != null">is_private = #{isPrivate},</if>
|
|
|
<if test="secondImg != null">second_img = #{secondImg},</if>
|
|
<if test="secondImg != null">second_img = #{secondImg},</if>
|
|
|
<if test="companyIds != null">company_ids = #{companyIds},</if>
|
|
<if test="companyIds != null">company_ids = #{companyIds},</if>
|
|
|
|
|
+ <if test="configJson != null">config_json = #{configJson},</if>
|
|
|
|
|
+ <if test="recHomeCourseTopEnabled != null">rec_home_course_top_enabled = #{recHomeCourseTopEnabled},</if>
|
|
|
|
|
+ <if test="recHomeCourseTopMode != null">rec_home_course_top_mode = #{recHomeCourseTopMode},</if>
|
|
|
|
|
+ <if test="recHomeCourseTopSort != null">rec_home_course_top_sort = #{recHomeCourseTopSort},</if>
|
|
|
|
|
+ <if test="recMallHomeEnabled != null">rec_mall_home_enabled = #{recMallHomeEnabled},</if>
|
|
|
|
|
+ <if test="recMallHomeMode != null">rec_mall_home_mode = #{recMallHomeMode},</if>
|
|
|
|
|
+ <if test="recMallHomeSort != null">rec_mall_home_sort = #{recMallHomeSort},</if>
|
|
|
|
|
+ <if test="recHomeLongVideoEnabled != null">rec_home_long_video_enabled = #{recHomeLongVideoEnabled},</if>
|
|
|
|
|
+ <if test="recHomeLongVideoMode != null">rec_home_long_video_mode = #{recHomeLongVideoMode},</if>
|
|
|
|
|
+ <if test="recHomeLongVideoSort != null">rec_home_long_video_sort = #{recHomeLongVideoSort},</if>
|
|
|
</trim>
|
|
</trim>
|
|
|
where course_id = #{courseId}
|
|
where course_id = #{courseId}
|
|
|
</update>
|
|
</update>
|
|
@@ -333,4 +379,81 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<!-- ORDER BY-->
|
|
<!-- ORDER BY-->
|
|
|
<!-- c.course_id-->
|
|
<!-- c.course_id-->
|
|
|
<!-- </select>-->
|
|
<!-- </select>-->
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 小程序公域课程列表:公域分类 + 非公域课 + 看课人数(去重 user_id, send_type=1) + 推荐位字段 -->
|
|
|
|
|
+ <select id="selectFsUserCoursePublicAppList" resultType="com.fs.course.vo.FsUserCoursePublicAppVO">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ c.course_id AS courseId,
|
|
|
|
|
+ COALESCE(c.title, c.course_name) AS courseTitle,
|
|
|
|
|
+ c.course_name AS courseName,
|
|
|
|
|
+ c.img_url AS imgUrl,
|
|
|
|
|
+ c.second_img AS secondImg,
|
|
|
|
|
+ IFNULL(wl_stat.watch_uv, 0) AS watchUserCount,
|
|
|
|
|
+ IFNULL(c.rec_home_course_top_enabled, 0) AS recHomeCourseTopEnabled,
|
|
|
|
|
+ c.rec_home_course_top_mode AS recHomeCourseTopMode,
|
|
|
|
|
+ c.rec_home_course_top_sort AS recHomeCourseTopSort,
|
|
|
|
|
+ IFNULL(c.rec_mall_home_enabled, 0) AS recMallHomeEnabled,
|
|
|
|
|
+ c.rec_mall_home_mode AS recMallHomeMode,
|
|
|
|
|
+ c.rec_mall_home_sort AS recMallHomeSort,
|
|
|
|
|
+ IFNULL(c.rec_home_long_video_enabled, 0) AS recHomeLongVideoEnabled,
|
|
|
|
|
+ c.rec_home_long_video_mode AS recHomeLongVideoMode,
|
|
|
|
|
+ c.rec_home_long_video_sort AS recHomeLongVideoSort
|
|
|
|
|
+ FROM fs_user_course c
|
|
|
|
|
+ LEFT JOIN (
|
|
|
|
|
+ SELECT course_id, COUNT(DISTINCT user_id) AS watch_uv
|
|
|
|
|
+ FROM fs_course_watch_log
|
|
|
|
|
+ WHERE send_type = 1
|
|
|
|
|
+ GROUP BY course_id
|
|
|
|
|
+ ) wl_stat ON wl_stat.course_id = c.course_id
|
|
|
|
|
+ WHERE IFNULL(c.is_del, 0) = 0
|
|
|
|
|
+ AND IFNULL(c.is_show, 0) = 1
|
|
|
|
|
+ AND IFNULL(c.is_private, 0) = 0
|
|
|
|
|
+ AND EXISTS (
|
|
|
|
|
+ SELECT 1 FROM fs_user_course_category pc2
|
|
|
|
|
+ WHERE pc2.cate_id = c.cate_id AND pc2.cate_type = 1 AND IFNULL(pc2.is_del, 0) = 0
|
|
|
|
|
+ )
|
|
|
|
|
+ AND (
|
|
|
|
|
+ c.sub_cate_id IS NULL
|
|
|
|
|
+ OR EXISTS (
|
|
|
|
|
+ SELECT 1 FROM fs_user_course_category sc2
|
|
|
|
|
+ WHERE sc2.cate_id = c.sub_cate_id AND sc2.cate_type = 1 AND IFNULL(sc2.is_del, 0) = 0
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ <if test="q.cateId != null and q.subCateId != null">
|
|
|
|
|
+ AND c.cate_id = #{q.cateId}
|
|
|
|
|
+ AND c.sub_cate_id = #{q.subCateId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="q.subCateId != null and q.cateId == null">
|
|
|
|
|
+ AND c.sub_cate_id = #{q.subCateId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="q.subCateId == null and q.cateId != null">
|
|
|
|
|
+ AND (c.cate_id = #{q.cateId} OR c.sub_cate_id = #{q.cateId})
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="q.keyword != null and q.keyword != ''">
|
|
|
|
|
+ AND (
|
|
|
|
|
+ c.title LIKE CONCAT('%', #{q.keyword}, '%')
|
|
|
|
|
+ OR c.course_name LIKE CONCAT('%', #{q.keyword}, '%')
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="q.recommendSlot != null and q.recommendSlot == 1">
|
|
|
|
|
+ AND IFNULL(c.rec_home_course_top_enabled, 0) = 1
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="q.recommendSlot != null and q.recommendSlot == 2">
|
|
|
|
|
+ AND IFNULL(c.rec_mall_home_enabled, 0) = 1
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="q.recommendSlot != null and q.recommendSlot == 3">
|
|
|
|
|
+ AND IFNULL(c.rec_home_long_video_enabled, 0) = 1
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ORDER BY
|
|
|
|
|
+ <if test="q.recommendSlot != null and q.recommendSlot == 1">
|
|
|
|
|
+ IFNULL(c.rec_home_course_top_sort, 999999) ASC,
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="q.recommendSlot != null and q.recommendSlot == 2">
|
|
|
|
|
+ IFNULL(c.rec_mall_home_sort, 999999) ASC,
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="q.recommendSlot != null and q.recommendSlot == 3">
|
|
|
|
|
+ IFNULL(c.rec_home_long_video_sort, 999999) ASC,
|
|
|
|
|
+ </if>
|
|
|
|
|
+ c.sort ASC, c.course_id DESC
|
|
|
|
|
+ </select>
|
|
|
</mapper>
|
|
</mapper>
|