<?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.SysMusicScoreChangeLogDao">
	<resultMap type="com.ym.mec.biz.dal.entity.SysMusicScoreChangeLog" id="SysMusicScoreChangeLog">
		<result column="id_" property="id" />
		<result column="sys_music_score_id_" property="sysMusicScoreId" />
		<result column="change_before_" property="changeBefore" />
		<result column="change_after_" property="changeAfter" />
		<result column="create_time_" property="createTime" />
	</resultMap>
	
	<!-- 根据主键查询一条记录 -->
	<select id="get" resultMap="SysMusicScoreChangeLog" >
		SELECT * FROM sys_music_score_change_log WHERE id_ = #{id}
	</select>
	
	<!-- 全查询 -->
	<select id="findAll" resultMap="SysMusicScoreChangeLog">
		SELECT * FROM sys_music_score_change_log ORDER BY id_
	</select>
	
	<!-- 向数据库增加一条记录 -->
	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysMusicScoreChangeLog" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
		INSERT INTO sys_music_score_change_log (sys_music_score_id_,change_before_,change_after_,create_time_)
		VALUES(#{sysMusicScoreId},#{changeBefore},#{changeAfter},now())
	</insert>

	<!-- 根据主键查询一条记录 -->
	<update id="update" parameterType="com.ym.mec.biz.dal.entity.SysMusicScoreChangeLog">
		UPDATE sys_music_score_change_log
		<set>
			<if test="sysMusicScoreId != null">
				sys_music_score_id_ = #{sysMusicScoreId},
			</if>
			<if test="changeBefore != null and changeBefore != ''">
				change_before_ = #{changeBefore},
			</if>
			<if test="changeAfter != null  and changeAfter != ''">
				change_after_ = #{changeAfter},
			</if>
		</set>
		WHERE id_ = #{id}
	</update>
	
	<!-- 根据主键删除一条记录 -->
	<delete id="delete" >
		delete from sys_music_score_change_log WHERE id_ = #{id}
	</delete>

	<!-- 分页查询 -->
	<select id="queryPage" resultMap="SysMusicScoreChangeLog" parameterType="map">
		SELECT t.*
		FROM sys_music_score_change_log t
		<include refid="queryPageSql"/>
		<include refid="global.limit"/>
	</select>
	
	<!-- 查询当前表的总记录数 -->
	<select id="queryCount" resultType="int">
		SELECT count(1) FROM sys_music_score_change_log t
		<include refid="queryPageSql"/>
	</select>

	<sql id="queryPageSql">
		<where>

		</where>
	</sql>
</mapper>
