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

	   	<insert id="saveLeshuaMakeMoneyBatch">
        	insert into tb_pluss_leshua_make_money(billId,createTime,merchantId,planAmount,suspendAmount,realAmount,state,failReason,remark,recreateFlag,settType,settDate,tag,bankretTime,bankAccount,bankHolder) VALUES 
    			<foreach collection="list" item="item" index="index" separator=",">
			(#{item.billId},#{item.createTime},#{item.merchantId},#{item.planAmount},#{item.suspendAmount},#{item.realAmount},#{item.state},#{item.failReason},#{item.remark},#{item.recreateFlag},#{item.settType},#{item.settDate},#{item.tag},#{item.bankretTime},#{item.bankAccount},#{item.bankHolder}		)
				</foreach>
    	</insert>

		<select id="queryLeshuaMakeMoneyPage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.LeshuaMakeMoney">
			SELECT * from tb_pluss_leshua_make_money 
				<where> 
					<if test="id!= null"> 
					and id = #{id}
					 </if> 
					<if test="billId!= null"> 
					and billId = #{billId}
					 </if> 
					<if test="createTime!= null"> 
					and createTime = #{createTime}
					 </if> 
					<if test="merchantId!= null"> 
					and merchantId = #{merchantId}
					 </if> 
					<if test="planAmount!= null"> 
					and planAmount = #{planAmount}
					 </if> 
					<if test="suspendAmount!= null"> 
					and suspendAmount = #{suspendAmount}
					 </if> 
					<if test="realAmount!= null"> 
					and realAmount = #{realAmount}
					 </if> 
					<if test="state!= null"> 
					and state = #{state}
					 </if> 
					<if test="failReason!= null"> 
					and failReason = #{failReason}
					 </if> 
					<if test="remark!= null"> 
					and remark = #{remark}
					 </if> 
					<if test="recreateFlag!= null"> 
					and recreateFlag = #{recreateFlag}
					 </if> 
					<if test="settType!= null"> 
					and settType = #{settType}
					 </if> 
					<if test="settDate!= null"> 
					and settDate = #{settDate}
					 </if> 
					<if test="tag!= null"> 
					and tag = #{tag}
					 </if> 
					<if test="bankretTime!= null"> 
					and bankretTime = #{bankretTime}
					 </if> 
					<if test="bankAccount!= null"> 
					and bankAccount = #{bankAccount}
					 </if> 
					<if test="bankHolder!= null"> 
					and bankHolder = #{bankHolder}
					 </if> 
				 </where> 
			order by createTime desc  limit #{pageSize}  offset  #{offset}  
		</select>

	<select id="queryLeshuaMakeMoneyPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
		SELECT count(*) from tb_pluss_leshua_make_money
		<where>
			<if test="id!= null">
				and id = #{id}
			</if>
			<if test="billId!= null">
				and billId = #{billId}
			</if>
			<if test="createTime!= null">
				and createTime = #{createTime}
			</if>
			<if test="merchantId!= null">
				and merchantId = #{merchantId}
			</if>
			<if test="planAmount!= null">
				and planAmount = #{planAmount}
			</if>
			<if test="suspendAmount!= null">
				and suspendAmount = #{suspendAmount}
			</if>
			<if test="realAmount!= null">
				and realAmount = #{realAmount}
			</if>
			<if test="state!= null">
				and state = #{state}
			</if>
			<if test="failReason!= null">
				and failReason = #{failReason}
			</if>
			<if test="remark!= null">
				and remark = #{remark}
			</if>
			<if test="recreateFlag!= null">
				and recreateFlag = #{recreateFlag}
			</if>
			<if test="settType!= null">
				and settType = #{settType}
			</if>
			<if test="settDate!= null">
				and settDate = #{settDate}
			</if>
			<if test="tag!= null">
				and tag = #{tag}
			</if>
			<if test="bankretTime!= null">
				and bankretTime = #{bankretTime}
			</if>
			<if test="bankAccount!= null">
				and bankAccount = #{bankAccount}
			</if>
			<if test="bankHolder!= null">
				and bankHolder = #{bankHolder}
			</if>
		</where>
	</select>
</mapper>
