<?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.ruoyi.course.mapper.ScBookCourseMapper">


    <select id="getListByStudent" resultType="com.ruoyi.course.domain.time.ClaTimeBookItem">
        SELECT
            a.create_time,
            a.id as book_id,
            a.book_status,
            c.course_time_id,
            c.cla_color,
            c.cla_date,
            c.start_time,
            c.end_time,
            c.book_attend_cnt,
            c.at_class_cnt,
            c.status as cla_time_status,
            c.room_name,
            b.teacher_name,
            b.avatar_img as pic,
            d.store_name

        from
            sc_book_course a,
            sys_teacher b,
            sc_cla_time c,
            yj_store d
        where  a.course_time_id =c.course_time_id
          and c.teacher_id=b.user_id
          and c.dept_id=d.dept_id
          and a.student_id=#{studentId}
        ORDER BY a.create_time
    </select>

    <select id="getDetail" resultType="com.ruoyi.course.domain.time.ClaTimeBookItem">
        select
            a.qr_code,
            a.create_time,
            a.id as book_id,
            b.course_time_id,
            a.book_status,
            a.code,
            a.check_in,
            b.room_name,
            b.cla_date,
            b.start_time,
            b.end_time,
            c.teacher_name,
            c.avatar_img as pic,
            d.course_name,
            e.store_name

        from
            sc_book_course a,
            sc_cla_time b,
            sys_teacher c,
            sc_course d,
            yj_store e

        WHERE a.course_time_id=b.course_time_id
          and b.course_id=d.course_id
          and b.teacher_id=c.user_id
          and b.dept_id=e.dept_id
          and a.id=#{bookId}
    </select>
</mapper>
