<?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.miaxis.wx.mapper.RefundRecordMapper">

    <resultMap type="RefundRecord" id="RefundRecordResult">
        <result property="id"    column="id"    />
        <result property="refundId"    column="refund_id"    />
        <result property="outRefundNo"    column="out_refund_no"    />
        <result property="transactionId"    column="transaction_id"    />
        <result property="outTradeNo"    column="out_trade_no"    />
        <result property="channel"    column="channel"    />
        <result property="userReceivedAccount"    column="user_received_account"    />
        <result property="successTime"    column="success_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="status"    column="status"    />
        <result property="fundsAccount"    column="funds_account"    />
        <result property="total"    column="total"    />
        <result property="refund"    column="refund"    />
        <result property="payerTotal"    column="payer_total"    />
        <result property="payerRefund"    column="payer_refund"    />
        <result property="settlementRefund"    column="settlement_refund"    />
        <result property="settlementTotal"    column="settlement_total"    />
        <result property="discountRefund"    column="discount_refund"    />
        <result property="currency"    column="currency"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectRefundRecordVo">
        select * from refund_record
    </sql>

    <select id="selectRefundRecordList" parameterType="RefundRecord" resultMap="RefundRecordResult">
        <include refid="selectRefundRecordVo"/>
        <where>
            <if test="refundId != null  and refundId != ''"> and refund_id = #{refundId}</if>
            <if test="outRefundNo != null  and outRefundNo != ''"> and out_refund_no = #{outRefundNo}</if>
            <if test="transactionId != null  and transactionId != ''"> and transaction_id = #{transactionId}</if>
            <if test="outTradeNo != null  and outTradeNo != ''"> and out_trade_no = #{outTradeNo}</if>
            <if test="channel != null  and channel != ''"> and channel = #{channel}</if>
            <if test="userReceivedAccount != null  and userReceivedAccount != ''"> and user_received_account = #{userReceivedAccount}</if>
            <if test="successTime != null "> and success_time = #{successTime}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="fundsAccount != null  and fundsAccount != ''"> and funds_account = #{fundsAccount}</if>
            <if test="total != null "> and total = #{total}</if>
            <if test="refund != null "> and refund = #{refund}</if>
            <if test="payerTotal != null "> and payer_total = #{payerTotal}</if>
            <if test="payerRefund != null "> and payer_refund = #{payerRefund}</if>
            <if test="settlementRefund != null "> and settlement_refund = #{settlementRefund}</if>
            <if test="settlementTotal != null "> and settlement_total = #{settlementTotal}</if>
            <if test="discountRefund != null "> and discount_refund = #{discountRefund}</if>
            <if test="currency != null  and currency != ''"> and currency = #{currency}</if>
        </where>
    </select>

    <select id="getByRefundId" parameterType="string" resultType="com.miaxis.wx.domain.RefundRecord">
        select * from refund_record where refund_id =#{refundId}
    </select>


</mapper>
