<?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.CourseAttachmentMapper">

    <resultMap type="com.hc.business.model.CourseAttachment" id="CourseAttachmentMap">
        <result property="attachmentId" column="attachment_id" jdbcType="INTEGER"/>
        <result property="courseId" column="course_id" jdbcType="INTEGER"/>
        <result property="name" column="name" jdbcType="VARCHAR"/>
        <result property="content" column="content" jdbcType="VARCHAR"/>
        <result property="url" column="url" jdbcType="VARCHAR"/>
        <result property="index" column="index_num" jdbcType="INTEGER"/>
    </resultMap>

    <sql id="Base_Column_List">
        attachment_id,
           course_id,
           name,
           content,
           url,
           index_num
    </sql>


    <select id="queryByCourseId" resultType="com.hc.business.model.CourseAttachment">
        SELECT
        <include refid="Base_Column_List"/>
        FROM course_attachment
        WHERE course_id =#{courseId}

    </select>

</mapper>
