<?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="vip.xiaonuo.disk.mapper.ClassHourMapper">
   <select id="page" resultType="vip.xiaonuo.disk.vo.classhour.ClassHourVo">
       SELECT
           a."id",
           a."start_time",
           a."end_time",
           a."class_id",
           a."course_id",
           a."remark",
           a.DELETE_FLAG,
           a.UPDATE_TIME,
           a.CREATE_TIME,
           a.CREATE_USER,
           a.UPDATE_USER,
           b.class_name,
           c.COURSE_NAME
       FROM
           SYSDBA."class_hour" a
       LEFT JOIN class_team b ON a."class_id" = b.id
       LEFT JOIN COURSE_INFO c ON a."course_id" =c.course_id
       <where>
          <if test="classHourPageParam.courseId!=null">
              a."course_id"=#{classHourPageParam.courseId}
          </if>
           <if test="classHourPageParam.classId!=null">
              and a."class_id"=#{classHourPageParam.classId}
           </if>
       </where>
   </select>

    <select id="detail" resultType="vip.xiaonuo.disk.vo.classhour.ClassHourVo">
        SELECT
            a."id",
            a."start_time",
            a."end_time",
            a."class_id",
            a."course_id",
            a."remark",
            a.DELETE_FLAG,
            a.UPDATE_TIME,
            a.CREATE_TIME,
            a.CREATE_USER,
            a.UPDATE_USER,
            b.class_name,
            c.COURSE_NAME
        FROM
            SYSDBA."class_hour" a
        LEFT JOIN class_team b ON a."class_id" = b.id
        LEFT JOIN COURSE_INFO c ON a."course_id" =c.course_id
        where a."id"=#{id}
    </select>
</mapper>
