<?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.iformall.mapper.WxProfitSharingResultMapper">
	<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxProfitSharingResult">
		<id column="id" jdbcType="BIGINT" property="id" />
		<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
		<result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
		<result column="sharing_order_id" jdbcType="BIGINT" property="sharingOrderId" />
		<result column="sharing_receiver_id" jdbcType="BIGINT" property="sharingReceiverId" />
		<result column="pay_amount" jdbcType="INTEGER" property="payAmount" />
		<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
		<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
		<result column="sharing_status" jdbcType="INTEGER" property="sharingStatus" />
		<result column="finish_time" jdbcType="VARCHAR" property="finishTime" />
		<result column="failed_reason" jdbcType="VARCHAR" property="failedReason" />
		<result column="description" jdbcType="VARCHAR" property="description" />
	</resultMap>
	
	<sql id="allColumns">
	    `id`,`tenant_id`,`merchant_id`,`sharing_order_id`,`sharing_receiver_id`,`pay_amount`,`update_time`,`create_time`,`sharing_status`,`finish_time`,`failed_reason`,`description`
	</sql>

	<sql id="dynamicWhereConditions">
	        where 1 = 1
	    
		<if test=" null != id "> 
		and `id` = #{id} 
       	
		</if>

		<if test=" null != tenantId ">
			and `tenant_id` = #{tenantId}

		</if>

		<if test=" null != merchantId ">
			and `merchant_id` = #{merchantId}

		</if>

		<if test=" null != sharingOrderId "> 
		and `sharing_order_id` = #{sharingOrderId} 
       	
		</if>    
	    
		<if test=" null != sharingReceiverId "> 
		and `sharing_receiver_id` = #{sharingReceiverId} 
       	
		</if>    
	    
		<if test=" null != payAmount "> 
		and `pay_amount` = #{payAmount} 
       	
		</if>    
	    
		<if test=" null != updateTime "> 
		and `update_time` = #{updateTime} 
       	
		</if>    
	    
		<if test=" null != createTime "> 
		and `create_time` = #{createTime} 
       	
		</if>    
	    
		<if test=" null != sharingStatus "> 
		and `sharing_status` = #{sharingStatus} 
       	
		</if>    
	    
		<if test=" null != finishTime "> 
		and `finish_time`  like concat('%', #{finishTime},'%')
       	
		</if>    
	    
		<if test=" null != failedReason "> 
		and `failed_reason`  like concat('%', #{failedReason},'%')
       	
		</if>    
		<if test=" null != ids ">
		 	and id in  
			<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
			#{idItem}
			</foreach>
		</if>		
		<if test=" null != sortColumns"> order by ${sortColumns} </if>
	</sql>
	
	<select id="findList" parameterType="com.iformall.domain.po.WxProfitSharingResult" resultMap="BaseResultMap">
		select <include refid="allColumns" /> from wx_profit_sharing_result
		<include refid="dynamicWhereConditions" />
	</select>
	
	
	
	
	
	
</mapper>
