<?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.MerchantRegistAuditRecordMapper">

	   	<insert id="saveMerchantRegistAuditRecord" parameterType="cn.pluss.platform.entity.MerchantRegistAuditRecord">
        	insert into tb_pluss_merchant_regist_audit_record(merchantCode,merchantName,agentCode,agentName,creator,message,type,status,failReason,creatDt,modifyStatus)VALUES(#{merchantCode},#{merchantName},#{agentCode},#{agentName},#{creator},#{message},#{type},#{status},#{failReason},#{creatDt},#{modifyStatus})
    	</insert>

	   	<insert id="saveMerchantRegistAuditRecordBatch">
        	insert into tb_pluss_merchant_regist_audit_record(merchantCode,merchantName,agentCode,agentName,creator,message,type,status,failReason,creatDt,modifyStatus) VALUES 
    			<foreach collection="list" item="item" index="index" separator=",">
			(#{merchantCode},#{merchantName},#{agentCode},#{agentName},#{creator},#{message},#{type},#{status},#{failReason},#{creatDt},#{modifyStatus}		)
				</foreach>
    	</insert>

		<select id="queryMerchantRegistAuditRecord" parameterType="cn.pluss.platform.entity.MerchantRegistAuditRecord" resultType="cn.pluss.platform.entity.MerchantRegistAuditRecord">
			SELECT * from tb_pluss_merchant_regist_audit_record 
				<where> 
					<if test="id!= null"> 
					 	and id = #{id}
					 </if> 
					<if test="merchantCode!= null"> 
					 	and merchantCode = #{merchantCode}
					 </if> 
					<if test="merchantName!= null"> 
					 	and merchantName = #{merchantName}
					 </if> 
					<if test="agentCode!= null"> 
					 	and agentCode = #{agentCode}
					 </if> 
					<if test="agentName!= null"> 
					 	and agentName = #{agentName}
					 </if> 
					<if test="creator!= null"> 
					 	and creator = #{creator}
					 </if> 
					<if test="message!= null"> 
					 	and message = #{message}
					 </if> 
					<if test="type!= null"> 
					 	and type = #{type}
					 </if> 
					<if test="status!= null"> 
					 	and status = #{status}
					 </if> 
					<if test="failReason!= null"> 
					 	and failReason = #{failReason}
					 </if> 
					<if test="creatDt!= null"> 
					 	and creatDt = #{creatDt}
					 </if> 
					<if test="modifyStatus!= null"> 
					 	and modifyStatus = #{modifyStatus}
					 </if> 
				 </where> 
		</select>

		<select id="queryMerchantRegistAuditRecordList" parameterType="cn.pluss.platform.entity.MerchantRegistAuditRecord" resultType="cn.pluss.platform.entity.MerchantRegistAuditRecord">
			SELECT * from tb_pluss_merchant_regist_audit_record 
				<where> 
					<if test="id!= null"> 
					 and 	id = #{id}
					 </if> 
					<if test="merchantCode!= null"> 
					 and 	merchantCode = #{merchantCode}
					 </if> 
					<if test="merchantName!= null"> 
					 and 	merchantName = #{merchantName}
					 </if> 
					<if test="agentCode!= null"> 
					 and 	agentCode = #{agentCode}
					 </if> 
					<if test="agentName!= null"> 
					 and 	agentName = #{agentName}
					 </if> 
					<if test="creator!= null"> 
					 and 	creator = #{creator}
					 </if> 
					<if test="message!= null"> 
					 and 	message = #{message}
					 </if> 
					<if test="type!= null"> 
					 and 	type = #{type}
					 </if> 
					<if test="status!= null"> 
					 and 	status = #{status}
					 </if> 
					<if test="failReason!= null"> 
					 and 	failReason = #{failReason}
					 </if> 
					<if test="creatDt!= null"> 
					 and 	creatDt = #{creatDt}
					 </if> 
					<if test="modifyStatus!= null"> 
					 and 	modifyStatus = #{modifyStatus}
					 </if> 
				 </where> 
		</select>

		<update id="updateMerchantRegistAuditRecord" parameterType="cn.pluss.platform.entity.MerchantRegistAuditRecord" >
			update tb_pluss_merchant_regist_audit_record 
				  <set> 
					<if test="merchantCode!= null"> 
					 	merchantCode = #{merchantCode},
					 </if> 
					<if test="merchantName!= null"> 
					 	merchantName = #{merchantName},
					 </if> 
					<if test="agentCode!= null"> 
					 	agentCode = #{agentCode},
					 </if> 
					<if test="agentName!= null"> 
					 	agentName = #{agentName},
					 </if> 
					<if test="creator!= null"> 
					 	creator = #{creator},
					 </if> 
					<if test="message!= null"> 
					 	message = #{message},
					 </if> 
					<if test="type!= null"> 
					 	type = #{type},
					 </if> 
					<if test="status!= null"> 
					 	status = #{status},
					 </if> 
					<if test="failReason!= null"> 
					 	failReason = #{failReason},
					 </if> 
					<if test="creatDt!= null"> 
					 	creatDt = #{creatDt},
					 </if> 
					<if test="modifyStatus!= null"> 
					 	modifyStatus = #{modifyStatus}
					 </if> 
				</set>
			where id=#{id} 
		</update>

		<delete id="deleteMerchantRegistAuditRecord" parameterType="cn.pluss.platform.entity.MerchantRegistAuditRecord" >
			DELETE FROM tb_pluss_merchant_regist_audit_record where id=#{id}
		</delete>

		<select id="queryMerchantRegistAuditRecordPage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.MerchantRegistAuditRecord">
			SELECT * from tb_pluss_merchant_regist_audit_record 
				<where> 
					<if test="id!= null"> 
					and id = #{id}
					 </if> 
					<if test="merchantCode!= null"> 
					and merchantCode = #{merchantCode}
					 </if> 
					<if test="merchantName!= null"> 
					and merchantName = #{merchantName}
					 </if> 
					<if test="agentCode!= null"> 
					and agentCode = #{agentCode}
					 </if> 
					<if test="agentName!= null"> 
					and agentName = #{agentName}
					 </if> 
					<if test="creator!= null"> 
					and creator = #{creator}
					 </if> 
					<if test="message!= null"> 
					and message = #{message}
					 </if> 
					<if test="type!= null"> 
					and type = #{type}
					 </if> 
					<if test="status!= null"> 
					and status = #{status}
					 </if> 
					<if test="failReason!= null"> 
					and failReason = #{failReason}
					 </if> 
					<if test="creatDt!= null"> 
					and creatDt = #{creatDt}
					 </if> 
					<if test="modifyStatus!= null"> 
					and modifyStatus = #{modifyStatus}
					 </if> 
				 </where> 
			order by id desc  limit #{pageSize}  offset  #{offset}  
		</select>

		<select id="queryMerchantRegistAuditRecordPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
			SELECT count(*) from tb_pluss_merchant_regist_audit_record 
					<where> 
					<if test="id!= null"> 
					 and id = #{id}
					 </if> 
					<if test="merchantCode!= null"> 
					 and merchantCode = #{merchantCode}
					 </if> 
					<if test="merchantName!= null"> 
					 and merchantName = #{merchantName}
					 </if> 
					<if test="agentCode!= null"> 
					 and agentCode = #{agentCode}
					 </if> 
					<if test="agentName!= null"> 
					 and agentName = #{agentName}
					 </if> 
					<if test="creator!= null"> 
					 and creator = #{creator}
					 </if> 
					<if test="message!= null"> 
					 and message = #{message}
					 </if> 
					<if test="type!= null"> 
					 and type = #{type}
					 </if> 
					<if test="status!= null"> 
					 and status = #{status}
					 </if> 
					<if test="failReason!= null"> 
					 and failReason = #{failReason}
					 </if> 
					<if test="creatDt!= null"> 
					 and creatDt = #{creatDt}
					 </if> 
					<if test="modifyStatus!= null"> 
					 and modifyStatus = #{modifyStatus}
					 </if> 
				</where>
		</select>

</mapper>
