<?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="lingtao.net.dao.UpdateLogMapper">

	<select id="getUpdateLogs" parameterType="UpdateLog"
		resultType="UpdateLog">
		SELECT
		*
		FROM
		tbl_update_log
		<where>
			<if test="content != null and content != ''">
				content like '%${content}%'
			</if>
			<if test="add_time_begin != null and add_time_begin != ''">
			  	<![CDATA[ and addTime  >=  #{add_time_begin}]]>
			</if>
			<if test="add_time_end != null and add_time_end != ''">
				<![CDATA[ and addTime  <=  #{add_time_end}  ]]>
			</if>
		</where>
		order by addTime desc
	</select>

	<insert id="addLog" parameterType="UpdateLog">
		insert into tbl_update_log
		(content,addTime,createBy,createDate)
		values
		(#{content},#{addTime},#{createBy},now())
	</insert>
	
	<update id="updateLogById">
		update tbl_update_log
		<set>
			<if test="content != null">
				content = #{content,jdbcType=VARCHAR},
			</if>
		</set>
		where id = #{id,jdbcType=INTEGER}
	</update>
	
	<delete id="deleteLogById" parameterType="java.lang.Integer">
    	delete from tbl_update_log
    	where id = #{id,jdbcType=INTEGER}
  </delete>
</mapper>