<?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.yonge.cooleshow.biz.dal.dao.StudentAttendanceDao">
	<resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.StudentAttendance">
            <result column="id_" property="id" />
	        <result column="course_group_type_" property="courseGroupType" />
	        <result column="course_group_id_" property="courseGroupId" />
	        <result column="course_schedule_id_" property="courseScheduleId" />
	        <result column="student_id_" property="studentId" />
	        <result column="sign_in_time_" property="signInTime" />
	        <result column="sign_out_time_" property="signOutTime" />
	        <result column="create_time_" property="createTime" />
	        <result column="update_time_" property="updateTime" />
		</resultMap>  
    
    <!-- 表字段 -->
    <sql id="baseColumns">
         t.id_
        , t.course_group_type_
        , t.course_group_id_
        , t.course_schedule_id_
        , t.student_id_
        , t.sign_in_time_
        , t.sign_out_time_
        , t.create_time_
        , t.update_time_
        </sql> 
    
    <select id="detail" resultType="com.yonge.cooleshow.biz.dal.vo.StudentAttendanceVo">
        SELECT
            <include refid="baseColumns"/>
        FROM student_attendance t
        where t.id_ = #{id}
    </select>
    
    <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.StudentAttendanceVo">
		SELECT         
        	<include refid="baseColumns" />
		FROM student_attendance t
	</select>
    <select id="findByUserIdAndCourseId" resultMap="BaseResultMap">
        select * from student_attendance where student_id_ = #{userId} and
        course_schedule_id_ = #{scheduleId} LIMIT 1
    </select>
</mapper>