<?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.WxRefundOrderMapper">
	<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxRefundOrder">
		<id column="id" jdbcType="BIGINT" property="id" />
		<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
		<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
		<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
		<result column="transaction_id" jdbcType="VARCHAR" property="transactionId" />
		<result column="order_id" jdbcType="BIGINT" property="orderId" />
		<result column="pay_order_no" jdbcType="VARCHAR" property="payOrderNo" />
		<result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
		<result column="total_fee" jdbcType="INTEGER" property="totalFee" />
		<result column="refund_fee" jdbcType="INTEGER" property="refundFee" />
		<result column="refund_time_start" jdbcType="TIMESTAMP" property="refundTimeStart" />
		<result column="refund_time_end" jdbcType="TIMESTAMP" property="refundTimeEnd" />
		<result column="refund_vendor" jdbcType="INTEGER" property="refundVendor" />
		<result column="refund_order_status" jdbcType="INTEGER" property="refundOrderStatus" />
		<result column="refund_id" jdbcType="VARCHAR" property="refundId" />
		<result column="fail_reason" jdbcType="VARCHAR" property="failReason" />
	</resultMap>
	
	<sql id="allColumns">
	    `id`,`tenant_id`,`create_time`,`update_time`,`transaction_id`,`order_id`,`pay_order_no`,`c_user_id`,`total_fee`,`refund_fee`,`refund_time_start`,`refund_time_end`,`refund_vendor`,`refund_order_status`,`refund_id`,`fail_reason` 
	</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 != createTime "> 
		and `create_time` = #{createTime} 
       	
		</if>    
	    
		<if test=" null != updateTime "> 
		and `update_time` = #{updateTime} 
       	
		</if>    
	    
		<if test=" null != transactionId "> 
		and `transaction_id`  like concat('%', #{transactionId},'%')
       	
		</if>    
	    
		<if test=" null != orderId "> 
		and `order_id` = #{orderId} 
       	
		</if>    
	    
		<if test=" null != payOrderNo "> 
		and `pay_order_no`  like concat('%', #{payOrderNo},'%')
       	
		</if>    
	    
		<if test=" null != cUserId "> 
		and `c_user_id` = #{cUserId} 
       	
		</if>    
	    
		<if test=" null != totalFee "> 
		and `total_fee` = #{totalFee} 
       	
		</if>    
	    
		<if test=" null != refundFee "> 
		and `refund_fee` = #{refundFee} 
       	
		</if>    
	    
		<if test=" null != refundTimeStart "> 
		and `refund_time_start` = #{refundTimeStart} 
       	
		</if>    
	    
		<if test=" null != refundTimeEnd "> 
		and `refund_time_end` = #{refundTimeEnd} 
       	
		</if>    
	    
		<if test=" null != refundVendor "> 
		and `refund_vendor` = #{refundVendor} 
       	
		</if>    
	    
		<if test=" null != refundOrderStatus "> 
		and `refund_order_status` = #{refundOrderStatus} 
       	
		</if>    
	    
		<if test=" null != refundId "> 
		and `refund_id`  like concat('%', #{refundId},'%')
       	
		</if>    
	    
		<if test=" null != failReason "> 
		and `fail_reason`  like concat('%', #{failReason},'%')
       	
		</if>    
		<if test=" null != ids ">
		 	and id in  
			<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
			#{idItem}
			</foreach>
		</if>
		and `refund_id` is not null
		<if test=" null != sortColumns"> order by ${sortColumns} </if>
	</sql>
	
	<select id="findList" parameterType="com.iformall.domain.po.WxRefundOrder" resultMap="BaseResultMap">
		select <include refid="allColumns" /> from wx_refund_order
		<include refid="dynamicWhereConditions" />
	</select>
	
	
	
	
	
	
</mapper>
