<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.tcm.training.admin.live.mapper.HealthCourseMapper">
|
|
<sql id="HealthCourseSelect">
|
SELECT
|
c.id,
|
c.title,
|
c.level_category_id AS levelCategoryId,
|
lc.name AS levelName,
|
c.difficulty_category_id AS difficultyCategoryId,
|
dc.name AS difficultyName,
|
c.expert_id AS expertId,
|
e.name AS expertName,
|
e.avatar AS expertAvatar,
|
c.sale_price AS salePrice,
|
c.summary,
|
c.target_users AS targetUsers,
|
c.cover_img AS coverImg,
|
c.banner_imgs AS bannerImgs,
|
c.content,
|
c.base_sales_count AS baseSalesCount,
|
c.real_sales_count AS realSalesCount,
|
c.learn_user_count AS learnUserCount,
|
c.favorite_count AS favoriteCount,
|
c.total_duration_seconds AS totalDurationSeconds,
|
c.video_count AS videoCount,
|
c.status,
|
c.is_home_recommend AS isHomeRecommend,
|
c.sort,
|
c.created_at AS createdAt,
|
c.updated_at AS updatedAt
|
FROM tcm_health_course c
|
LEFT JOIN tcm_live_course_category lc ON lc.id = c.level_category_id AND lc.deleted = 0
|
LEFT JOIN tcm_live_course_category dc ON dc.id = c.difficulty_category_id AND dc.deleted = 0
|
LEFT JOIN tcm_expert e ON e.id = c.expert_id AND e.deleted = 0
|
WHERE c.deleted = 0
|
</sql>
|
|
<select id="selectCoursePage" resultType="com.tcm.training.admin.live.vo.HealthCourseListRow">
|
<include refid="HealthCourseSelect"/>
|
<if test="keyword != null and keyword.trim() != ''">
|
AND c.title LIKE CONCAT('%', #{keyword}, '%')
|
</if>
|
<if test="levelCategoryId != null">
|
AND c.level_category_id = #{levelCategoryId}
|
</if>
|
<if test="difficultyCategoryId != null">
|
AND c.difficulty_category_id = #{difficultyCategoryId}
|
</if>
|
<if test="status != null">
|
AND c.status = #{status}
|
</if>
|
ORDER BY c.sort ASC, c.id DESC
|
</select>
|
|
<select id="selectCourseList" resultType="com.tcm.training.admin.live.vo.HealthCourseListRow">
|
<include refid="HealthCourseSelect"/>
|
<if test="keyword != null and keyword.trim() != ''">
|
AND c.title LIKE CONCAT('%', #{keyword}, '%')
|
</if>
|
<if test="levelCategoryId != null">
|
AND c.level_category_id = #{levelCategoryId}
|
</if>
|
<if test="difficultyCategoryId != null">
|
AND c.difficulty_category_id = #{difficultyCategoryId}
|
</if>
|
<if test="status != null">
|
AND c.status = #{status}
|
</if>
|
ORDER BY c.sort ASC, c.id DESC
|
</select>
|
|
<select id="selectCourseDetail" resultType="com.tcm.training.admin.live.vo.HealthCourseDetailRow">
|
<include refid="HealthCourseSelect"/>
|
AND c.id = #{id}
|
</select>
|
|
</mapper>
|