<?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="cn.pluss.platform.mapper.MerchantRegistLogMapper">

	   	<insert id="saveMerchantRegistLog" parameterType="cn.pluss.platform.entity.MerchantRegistLog">
        	insert into tb_pluss_merchant_regist_log(merchantCode,storeId,applyStatus,message,createDt,merchantName,merchantId,parentCode,creator)VALUES(#{merchantCode},#{storeId},#{applyStatus},#{message},#{createDt},#{merchantName},#{merchantId},#{parentCode},#{creator})
    	</insert>

	   	<insert id="saveMerchantRegistLogBatch">
        	insert into tb_pluss_merchant_regist_log(merchantCode,storeId,applyStatus,message,createDt,merchantName,merchantId,parentCode,creator) VALUES 
    			<foreach collection="list" item="item" index="index" separator=",">
			(#{merchantCode},#{storeId},#{applyStatus},#{message},#{createDt},#{merchantName},#{merchantId},#{parentCode},#{creator}		)
				</foreach>
    	</insert>

		<select id="queryMerchantRegistLog" parameterType="cn.pluss.platform.entity.MerchantRegistLog" resultType="cn.pluss.platform.entity.MerchantRegistLog">
			SELECT * from tb_pluss_merchant_regist_log 
				<where> 
					<if test="id!= null"> 
					 	and id = #{id}
					 </if> 
					<if test="merchantCode!= null"> 
					 	and merchantCode = #{merchantCode}
					 </if> 
					<if test="storeId!= null"> 
					 	and storeId = #{storeId}
					 </if> 
					<if test="applyStatus!= null"> 
					 	and applyStatus = #{applyStatus}
					 </if> 
					<if test="message!= null"> 
					 	and message = #{message}
					 </if> 
					<if test="createDt!= null"> 
					 	and createDt = #{createDt}
					 </if> 
					<if test="merchantName!= null"> 
					 	and merchantName = #{merchantName}
					 </if> 
					<if test="merchantId!= null"> 
					 	and merchantId = #{merchantId}
					 </if> 
					<if test="parentCode!= null"> 
					 	and parentCode = #{parentCode}
					 </if> 
					<if test="creator!= null"> 
					 	and creator = #{creator}
					 </if> 
				 </where> 
		</select>

		<select id="queryMerchantRegistLogList" parameterType="cn.pluss.platform.entity.MerchantRegistLog" resultType="cn.pluss.platform.entity.MerchantRegistLog">
			SELECT * from tb_pluss_merchant_regist_log 
				<where> 
					<if test="id!= null"> 
					 and 	id = #{id}
					 </if> 
					<if test="merchantCode!= null"> 
					 and 	merchantCode = #{merchantCode}
					 </if> 
					<if test="storeId!= null"> 
					 and 	storeId = #{storeId}
					 </if> 
					<if test="applyStatus!= null"> 
					 and 	applyStatus = #{applyStatus}
					 </if> 
					<if test="message!= null"> 
					 and 	message = #{message}
					 </if> 
					<if test="createDt!= null"> 
					 and 	createDt = #{createDt}
					 </if> 
					<if test="merchantName!= null"> 
					 and 	merchantName = #{merchantName}
					 </if> 
					<if test="merchantId!= null"> 
					 and 	merchantId = #{merchantId}
					 </if> 
					<if test="parentCode!= null"> 
					 and 	parentCode = #{parentCode}
					 </if> 
					<if test="creator!= null"> 
					 and 	creator = #{creator}
					 </if> 
				 </where> 
		</select>

		<update id="updateMerchantRegistLog" parameterType="cn.pluss.platform.entity.MerchantRegistLog" >
			update tb_pluss_merchant_regist_log 
				  <set> 
					<if test="merchantCode!= null"> 
					 	merchantCode = #{merchantCode},
					 </if> 
					<if test="storeId!= null"> 
					 	storeId = #{storeId},
					 </if> 
					<if test="applyStatus!= null"> 
					 	applyStatus = #{applyStatus},
					 </if> 
					<if test="message!= null"> 
					 	message = #{message},
					 </if> 
					<if test="createDt!= null"> 
					 	createDt = #{createDt},
					 </if> 
					<if test="merchantName!= null"> 
					 	merchantName = #{merchantName},
					 </if> 
					<if test="merchantId!= null"> 
					 	merchantId = #{merchantId},
					 </if> 
					<if test="parentCode!= null"> 
					 	parentCode = #{parentCode},
					 </if> 
					<if test="creator!= null"> 
					 	creator = #{creator}
					 </if> 
				</set>
			where id=#{id} 
		</update>

		<delete id="deleteMerchantRegistLog" parameterType="cn.pluss.platform.entity.MerchantRegistLog" >
			DELETE FROM tb_pluss_merchant_regist_log where id=#{id}
		</delete>

		<select id="queryMerchantRegistLogPage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.MerchantRegistLog">
			SELECT * from tb_pluss_merchant_regist_log 
				<where> 
					<if test="id!= null"> 
					and id = #{id}
					 </if> 
					<if test="merchantCode!= null"> 
					and merchantCode = #{merchantCode}
					 </if> 
					<if test="storeId!= null"> 
					and storeId = #{storeId}
					 </if> 
					<if test="applyStatus!= null"> 
					and applyStatus = #{applyStatus}
					 </if> 
					<if test="message!= null"> 
					and message = #{message}
					 </if> 
					<if test="createDt!= null"> 
					and createDt = #{createDt}
					 </if> 
					<if test="merchantName!= null"> 
					and merchantName = #{merchantName}
					 </if> 
					<if test="merchantId!= null"> 
					and merchantId = #{merchantId}
					 </if> 
					<if test="parentCode!= null"> 
					and parentCode = #{parentCode}
					 </if> 
					<if test="creator!= null"> 
					and creator = #{creator}
					 </if> 
				 </where> 
			order by id desc  limit #{pageSize}  offset  #{offset}  
		</select>

		<select id="queryMerchantRegistLogPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
			SELECT count(*) from tb_pluss_merchant_regist_log 
					<where> 
					<if test="id!= null"> 
					 and id = #{id}
					 </if> 
					<if test="merchantCode!= null"> 
					 and merchantCode = #{merchantCode}
					 </if> 
					<if test="storeId!= null"> 
					 and storeId = #{storeId}
					 </if> 
					<if test="applyStatus!= null"> 
					 and applyStatus = #{applyStatus}
					 </if> 
					<if test="message!= null"> 
					 and message = #{message}
					 </if> 
					<if test="createDt!= null"> 
					 and createDt = #{createDt}
					 </if> 
					<if test="merchantName!= null"> 
					 and merchantName = #{merchantName}
					 </if> 
					<if test="merchantId!= null"> 
					 and merchantId = #{merchantId}
					 </if> 
					<if test="parentCode!= null"> 
					 and parentCode = #{parentCode}
					 </if> 
					<if test="creator!= null"> 
					 and creator = #{creator}
					 </if> 
				</where>
		</select>

</mapper>
