<?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.koobietech.eas.mbg.mapper.EasEduScheduleMapper">
  <resultMap id="BaseResultMap" type="com.koobietech.eas.mbg.model.EasEduSchedule">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="week" jdbcType="INTEGER" property="week" />
    <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
    <result column="room_id" jdbcType="INTEGER" property="roomId" />
    <result column="class_id" jdbcType="INTEGER" property="classId" />
    <result column="assistant_id" jdbcType="INTEGER" property="assistantId" />
    <result column="teacher_id" jdbcType="INTEGER" property="teacherId" />
    <result column="category_id" jdbcType="INTEGER" property="categoryId" />
    <result column="subjects_id" jdbcType="INTEGER" property="subjectsId" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
    <result column="create_uid" jdbcType="INTEGER" property="createUid" />
    <result column="disabled" jdbcType="CHAR" property="disabled" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, week, start_time, end_time, room_id, class_id, assistant_id, teacher_id, category_id, 
    subjects_id, create_time, modify_time, create_uid, disabled
  </sql>
  <select id="selectByExample" parameterType="com.koobietech.eas.mbg.model.EasEduScheduleExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from eas_edu_schedule
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from eas_edu_schedule
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from eas_edu_schedule
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.koobietech.eas.mbg.model.EasEduScheduleExample">
    delete from eas_edu_schedule
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.koobietech.eas.mbg.model.EasEduSchedule">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into eas_edu_schedule (week, start_time, end_time, 
      room_id, class_id, assistant_id, 
      teacher_id, category_id, subjects_id, 
      create_time, modify_time, create_uid, 
      disabled)
    values (#{week,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, 
      #{roomId,jdbcType=INTEGER}, #{classId,jdbcType=INTEGER}, #{assistantId,jdbcType=INTEGER}, 
      #{teacherId,jdbcType=INTEGER}, #{categoryId,jdbcType=INTEGER}, #{subjectsId,jdbcType=INTEGER}, 
      #{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP}, #{createUid,jdbcType=INTEGER}, 
      #{disabled,jdbcType=CHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.koobietech.eas.mbg.model.EasEduSchedule">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into eas_edu_schedule
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="week != null">
        week,
      </if>
      <if test="startTime != null">
        start_time,
      </if>
      <if test="endTime != null">
        end_time,
      </if>
      <if test="roomId != null">
        room_id,
      </if>
      <if test="classId != null">
        class_id,
      </if>
      <if test="assistantId != null">
        assistant_id,
      </if>
      <if test="teacherId != null">
        teacher_id,
      </if>
      <if test="categoryId != null">
        category_id,
      </if>
      <if test="subjectsId != null">
        subjects_id,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="modifyTime != null">
        modify_time,
      </if>
      <if test="createUid != null">
        create_uid,
      </if>
      <if test="disabled != null">
        disabled,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="week != null">
        #{week,jdbcType=INTEGER},
      </if>
      <if test="startTime != null">
        #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="roomId != null">
        #{roomId,jdbcType=INTEGER},
      </if>
      <if test="classId != null">
        #{classId,jdbcType=INTEGER},
      </if>
      <if test="assistantId != null">
        #{assistantId,jdbcType=INTEGER},
      </if>
      <if test="teacherId != null">
        #{teacherId,jdbcType=INTEGER},
      </if>
      <if test="categoryId != null">
        #{categoryId,jdbcType=INTEGER},
      </if>
      <if test="subjectsId != null">
        #{subjectsId,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyTime != null">
        #{modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUid != null">
        #{createUid,jdbcType=INTEGER},
      </if>
      <if test="disabled != null">
        #{disabled,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.koobietech.eas.mbg.model.EasEduScheduleExample" resultType="java.lang.Long">
    select count(*) from eas_edu_schedule
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update eas_edu_schedule
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.week != null">
        week = #{record.week,jdbcType=INTEGER},
      </if>
      <if test="record.startTime != null">
        start_time = #{record.startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.endTime != null">
        end_time = #{record.endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.roomId != null">
        room_id = #{record.roomId,jdbcType=INTEGER},
      </if>
      <if test="record.classId != null">
        class_id = #{record.classId,jdbcType=INTEGER},
      </if>
      <if test="record.assistantId != null">
        assistant_id = #{record.assistantId,jdbcType=INTEGER},
      </if>
      <if test="record.teacherId != null">
        teacher_id = #{record.teacherId,jdbcType=INTEGER},
      </if>
      <if test="record.categoryId != null">
        category_id = #{record.categoryId,jdbcType=INTEGER},
      </if>
      <if test="record.subjectsId != null">
        subjects_id = #{record.subjectsId,jdbcType=INTEGER},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.modifyTime != null">
        modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createUid != null">
        create_uid = #{record.createUid,jdbcType=INTEGER},
      </if>
      <if test="record.disabled != null">
        disabled = #{record.disabled,jdbcType=CHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update eas_edu_schedule
    set id = #{record.id,jdbcType=BIGINT},
      week = #{record.week,jdbcType=INTEGER},
      start_time = #{record.startTime,jdbcType=TIMESTAMP},
      end_time = #{record.endTime,jdbcType=TIMESTAMP},
      room_id = #{record.roomId,jdbcType=INTEGER},
      class_id = #{record.classId,jdbcType=INTEGER},
      assistant_id = #{record.assistantId,jdbcType=INTEGER},
      teacher_id = #{record.teacherId,jdbcType=INTEGER},
      category_id = #{record.categoryId,jdbcType=INTEGER},
      subjects_id = #{record.subjectsId,jdbcType=INTEGER},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
      create_uid = #{record.createUid,jdbcType=INTEGER},
      disabled = #{record.disabled,jdbcType=CHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.koobietech.eas.mbg.model.EasEduSchedule">
    update eas_edu_schedule
    <set>
      <if test="week != null">
        week = #{week,jdbcType=INTEGER},
      </if>
      <if test="startTime != null">
        start_time = #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        end_time = #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="roomId != null">
        room_id = #{roomId,jdbcType=INTEGER},
      </if>
      <if test="classId != null">
        class_id = #{classId,jdbcType=INTEGER},
      </if>
      <if test="assistantId != null">
        assistant_id = #{assistantId,jdbcType=INTEGER},
      </if>
      <if test="teacherId != null">
        teacher_id = #{teacherId,jdbcType=INTEGER},
      </if>
      <if test="categoryId != null">
        category_id = #{categoryId,jdbcType=INTEGER},
      </if>
      <if test="subjectsId != null">
        subjects_id = #{subjectsId,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyTime != null">
        modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUid != null">
        create_uid = #{createUid,jdbcType=INTEGER},
      </if>
      <if test="disabled != null">
        disabled = #{disabled,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.koobietech.eas.mbg.model.EasEduSchedule">
    update eas_edu_schedule
    set week = #{week,jdbcType=INTEGER},
      start_time = #{startTime,jdbcType=TIMESTAMP},
      end_time = #{endTime,jdbcType=TIMESTAMP},
      room_id = #{roomId,jdbcType=INTEGER},
      class_id = #{classId,jdbcType=INTEGER},
      assistant_id = #{assistantId,jdbcType=INTEGER},
      teacher_id = #{teacherId,jdbcType=INTEGER},
      category_id = #{categoryId,jdbcType=INTEGER},
      subjects_id = #{subjectsId,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      create_uid = #{createUid,jdbcType=INTEGER},
      disabled = #{disabled,jdbcType=CHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>