<?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.DataChangeLogDao">
	
	<resultMap type="com.ym.mec.biz.dal.entity.DataChangeLog" id="DataChangeLog">
		<result column="id_" property="id" />
		<result column="data_id_" property="dataId" />
		<result column="operator_id_" property="operatorId" />
		<result column="change_info_" property="changeInfo" />
		<result column="create_time_" property="createTime" />
		<result column="class_name_" property="className" />
	</resultMap>
	
	<!-- 根据主键查询一条记录 -->
	<select id="get" resultMap="DataChangeLog" >
		SELECT * FROM data_change_log WHERE id_ = #{id} 
	</select>
	
	<!-- 全查询 -->
	<select id="findAll" resultMap="DataChangeLog">
		SELECT * FROM data_change_log ORDER BY id_
	</select>
	
	<!-- 向数据库增加一条记录 -->
	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.DataChangeLog" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
		INSERT INTO data_change_log (id_,data_id_,operator_id_,change_info_,create_time_,class_name_)
		VALUES(#{id},#{dataId},#{operatorId},#{changeInfo},NOW(),#{className})
	</insert>
	
	<!-- 根据主键查询一条记录 -->
	<update id="update" parameterType="com.ym.mec.biz.dal.entity.DataChangeLog">
		UPDATE data_change_log
		<set>
			<if test="operatorId != null">
				operator_id_ = #{operatorId},
			</if>
			<if test="id != null">
				id_ = #{id},
			</if>
			<if test="className != null">
				class_name_ = #{className},
			</if>
			<if test="changeInfo != null">
				change_info_ = #{changeInfo},
			</if>
		</set> WHERE id_ = #{id}
	</update>
	
	<!-- 根据主键删除一条记录 -->
	<delete id="delete" >
		DELETE FROM data_change_log WHERE id_ = #{id} 
	</delete>
	
	<!-- 分页查询 -->
	<select id="queryPage" resultMap="DataChangeLog" parameterType="map">
		SELECT * FROM data_change_log ORDER BY id_ <include refid="global.limit"/>
	</select>
	
	<!-- 查询当前表的总记录数 -->
	<select id="queryCount" resultType="int">
		SELECT COUNT(*) FROM data_change_log
	</select>
</mapper>
