<?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.hc.business.mapper.CourseChapterVideoMapper">

    <resultMap type="courseChapterVideo" id="CourseChapterVideoMap">
        <result property="videoId" column="video_id" jdbcType="INTEGER"/>
        <result property="chapterId" column="chapter_id" jdbcType="INTEGER"/>
        <result property="videoName" column="video_name" jdbcType="VARCHAR"/>
        <result property="videoUrl" column="video_url" jdbcType="VARCHAR"/>
        <result property="videoOriUrl" column="video_ori_url" jdbcType="VARCHAR"/>
        <result property="courseId" column="course_id" jdbcType="INTEGER"/>
        <result property="isFree" column="is_free" jdbcType="INTEGER"/>
        <result property="freeTime" column="free_time" jdbcType="INTEGER"/>
    </resultMap>

    <sql id="Base_Column_List">
        video_id,
           chapter_id,
           video_name,
           video_url,
           video_ori_url,
           course_id,
           is_free,
           free_time
    </sql>


    <select id="selectVideoByChapterId" resultMap="CourseChapterVideoMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM course_chapter_video
        WHERE chapter_id = #{chapterId,jdbcType=INTEGER}
    </select>


    <select id="selectVideoByCourseId" resultMap="CourseChapterVideoMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM course_chapter_video
        WHERE course_id = #{courseId,jdbcType=INTEGER}
    </select>

</mapper>