<?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.gpbusiness.mapper.WebCourseMapper">

    <resultMap type="com.hc.gpbusiness.model.WebCourse" id="CourseMap">
        <result property="courseId" column="course_id" jdbcType="INTEGER"/>
        <result property="courseName" column="course_name" jdbcType="VARCHAR"/>
        <result property="courseLogo" column="course_logo" jdbcType="VARCHAR"/>
        <result property="courseTeacherVisible" column="course_teacher_visible" jdbcType="INTEGER"/>
        <result property="courseChapterVisible" column="course_chapter_visible" jdbcType="INTEGER"/>
        <result property="courseDescVisible" column="course_desc_visible" jdbcType="INTEGER"/>
        <result property="courseDesc" column="course_desc" jdbcType="VARCHAR"/>
        <result property="courseHours" column="course_hours" jdbcType="FLOAT"/>
        <result property="courseTeacher" column="course_teacher" jdbcType="VARCHAR"/>
        <result property="isValid" column="is_valid" jdbcType="INTEGER"/>
        <result property="gallery" column="gallery" jdbcType="VARCHAR"/>
        <result property="moduleId" column="module_id" jdbcType="INTEGER"/>
        <result property="typeId" column="type_id" jdbcType="INTEGER"/>
        <result property="createTime" column="create_time" jdbcType="BIGINT"/>
        <result property="updateTime" column="update_time" jdbcType="BIGINT"/>
    </resultMap>

    <sql id="Base_Column_List">
           course_id,
           course_name,
           course_logo,
           course_teacher_visible,
           course_chapter_visible,
           course_desc_visible,
           course_desc,
           course_hours,
           course_teacher,
           is_valid,
           gallery,
           module_id,
               type_id,
           create_time,
           update_time
        </sql>

    <select id="queryByModuleId" resultMap="CourseMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM web_course
        WHERE module_id = #{moduleId}  order by create_time desc
    </select>

</mapper>