<?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.ym.mec.biz.dal.dao.CourseScheduleHistoryDao">
	
	<resultMap type="com.ym.mec.biz.dal.entity.CourseScheduleHistory" id="CourseScheduleHistory">
		<result column="id_" property="id" />
		<result column="class_group_id_" property="classGroupId" />
		<result column="status_" property="status" />
		<result column="subsidy_" property="subsidy" />
		<result column="class_date_" property="classDate" />
		<result column="start_class_time_" property="startClassTime" />
		<result column="end_class_time_" property="endClassTime" />
		<result column="teacher_id_" property="teacherId" />
		<result column="actual_teacher_id_" property="actualTeacherId" />
		<result column="create_time_" property="createTime" />
		<result column="update_time_" property="updateTime" />
		<result column="teach_mode_" property="teachMode" />
		<result column="complaint_status_" property="complaintStatus" />
		<result column="type_" property="type" />
		<result column="course_schedule_id_" property="courseScheduleId" />
	</resultMap>
	
	<!-- 根据主键查询一条记录 -->
	<select id="get" resultMap="CourseScheduleHistory" >
		SELECT * FROM course_schedule_history WHERE id_ = #{id} 
	</select>
	
	<!-- 全查询 -->
	<select id="findAll" resultMap="CourseScheduleHistory">
		SELECT * FROM course_schedule_history ORDER BY id_
	</select>
	
	<!-- 向数据库增加一条记录 -->
	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleHistory" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
		<!--
		<selectKey resultClass="int" keyProperty="id" > 
		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
		</selectKey>
		-->
		INSERT INTO course_schedule_history (id_,class_group_id_,status_,subsidy_,class_date_,start_class_time_,end_class_time_,teacher_id_,actual_teacher_id_,create_time_,update_time_,teach_mode_,complaint_status_,type_,course_schedule_id_) VALUES(#{id},#{classGroupId},#{status},#{subsidy},#{classDate},#{startClassTime},#{endClassTime},#{teacherId},#{actualTeacherId},#{createTime},NOW(),#{teachMode},#{complaintStatus},#{type},#{courseScheduleId})
	</insert>
	
	<!-- 根据主键查询一条记录 -->
	<update id="update" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleHistory">
		UPDATE course_schedule_history <set>
<if test="status != null">
status_ = #{status},
</if>
<if test="id != null">
id_ = #{id},
</if>
<if test="classGroupId != null">
class_group_id_ = #{classGroupId},
</if>
<if test="teachMode != null">
teach_mode_ = #{teachMode},
</if>
<if test="complaintStatus != null">
complaint_status_ = #{complaintStatus},
</if>
<if test="createTime != null">
create_time_ = #{createTime},
</if>
<if test="classDate != null">
class_date_ = #{classDate},
</if>
<if test="endClassTime != null">
end_class_time_ = #{endClassTime},
</if>
<if test="actualTeacherId != null">
actual_teacher_id_ = #{actualTeacherId},
</if>
<if test="subsidy != null">
subsidy_ = #{subsidy},
</if>
<if test="startClassTime != null">
start_class_time_ = #{startClassTime},
</if>
<if test="teacherId != null">
teacher_id_ = #{teacherId},
</if>
<if test="updateTime != null">
update_time_ = NOW(),
</if>
<if test="courseScheduleId != null">
course_schedule_id_ = #{courseScheduleId},
</if>
<if test="type != null">
type_ = #{type},
</if>
</set> WHERE id_ = #{id} 
	</update>
	
	<!-- 根据主键删除一条记录 -->
	<delete id="delete" >
		DELETE FROM course_schedule_history WHERE id_ = #{id} 
	</delete>
	
	<!-- 分页查询 -->
	<select id="queryPage" resultMap="CourseScheduleHistory" parameterType="map">
		SELECT * FROM course_schedule_history ORDER BY id_ <include refid="global.limit"/>
	</select>
	
	<!-- 查询当前表的总记录数 -->
	<select id="queryCount" resultType="int">
		SELECT COUNT(*) FROM course_schedule_history
	</select>
</mapper>
