<?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.WxSubsidyMapper">
	<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxSubsidy">
		<id column="id" jdbcType="BIGINT" property="id" />
		<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
		<result column="operator_user_id" jdbcType="VARCHAR" property="operatorUserId" />
		<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
		<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
		<result column="order_no" jdbcType="VARCHAR" property="orderNo" />
		<result column="body" jdbcType="VARCHAR" property="body" />
		<result column="ip" jdbcType="VARCHAR" property="ip" />
		<result column="status" jdbcType="INTEGER" property="status" />
		<result column="pay_time_start" jdbcType="TIMESTAMP" property="payTimeStart" />
		<result column="pay_time_end" jdbcType="TIMESTAMP" property="payTimeEnd" />
		<result column="prepay_id" jdbcType="VARCHAR" property="prepayId" />
		<result column="code_url" jdbcType="VARCHAR" property="codeUrl" />
		<result column="transaction_id" jdbcType="VARCHAR" property="transactionId" />
		<result column="amount" jdbcType="INTEGER" property="amount" />
		<result column="share_amount" jdbcType="INTEGER" property="shareAmount" />
		<result column="share_remain_amount" jdbcType="INTEGER" property="shareRemainAmount" />
		<result column="fail_reason" jdbcType="VARCHAR" property="failReason" />
		<result column="open_id" jdbcType="VARCHAR" property="openId" />
	</resultMap>
	
	<sql id="allColumns">
	    `id`,`tenant_id`,`operator_user_id`,`create_time`,`update_time`,`order_no`,`body`,`total_fee`,`ip`,`status`,
	    `pay_time_start`,`pay_time_end`,`prepay_id`,`code_url`,`transaction_id`,`amount`,`share_amount`,`share_remain_amount`,`fail_reason`,`open_id`
	</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 != orderNo ">
		    and `order_no`  like concat('%', #{orderNo},'%')
		</if>    
		<if test=" null != body ">
		    and `body`  like concat('%', #{body},'%')
		</if>
		<if test=" null != ip ">
		    and `ip`  like concat('%', #{ip},'%')
		</if>    
		<if test=" null != status ">
		    and `status` = #{status}
		</if>    
		<if test=" null != payTimeStart ">
		    and `pay_time_start` = #{payTimeStart}
		</if>    
		<if test=" null != payTimeEnd ">
		    and `pay_time_end` = #{payTimeEnd}
		</if>    
		<if test=" null != prepayId ">
		    and `prepay_id`  like concat('%', #{prepayId},'%')
		</if>    
		<if test=" null != codeUrl ">
		    and `code_url`  like concat('%', #{codeUrl},'%')
		</if>    
		<if test=" null != transactionId ">
		    and `transaction_id`  like concat('%', #{transactionId},'%')
		</if>    
		<if test=" null != amount ">
		    and `amount` = #{amount}
		</if>    
		<if test=" null != shareAmount ">
		    and `share_amount` = #{shareAmount}
		</if>    
		<if test=" null != shareRemainAmount ">
		    and `share_remain_amount` = #{shareRemainAmount}
		</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>
		<if test=" null != sortColumns"> order by ${sortColumns} </if>
	</sql>
	
	<select id="findList" parameterType="com.iformall.domain.po.WxSubsidy" resultMap="BaseResultMap">
		select <include refid="allColumns" /> from wx_subsidy
		<include refid="dynamicWhereConditions" />
	</select>
	
	
	
	
	
	
</mapper>
