<?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.yonge.cooleshow.biz.dal.dao.UserOrderRefundBillDao">
    <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.UserOrderRefundBill">
        <result column="id_" property="id" />
        <result column="refund_id_" property="refundId" />
        <result column="bill_no_" property="billNo" />
        <result column="trans_no_" property="transNo" />
        <result column="refund_amt_" property="refundAmt" />
        <result column="back_refund_amt_" property="backRefundAmt" />
        <result column="fee_amt_" property="feeAmt" />
        <result column="status_" property="status" />
        <result column="pay_fail_msg_" property="payFailMsg" />
        <result column="create_time_" property="createTime" />
        <result column="update_time_" property="updateTime" />
    </resultMap>

    <!-- 表字段 -->
    <sql id="baseColumns">
         t.id_ as id
        , t.refund_id_ as refundId
        , t.bill_no_ as billNo
        , t.trans_no_ as transNo
        , t.refund_amt_ as refundAmt
        , t.back_refund_amt_ as backRefundAmt
        , t.fee_amt_ as feeAmt
        , t.status_ as status
        , t.pay_fail_msg_ as payFailMsg
        , t.create_time_ as createTime
        , t.update_time_ as updateTime
        </sql>

    <select id="detail" resultType="com.yonge.cooleshow.biz.dal.vo.UserOrderRefundBillVo">
        SELECT
        <include refid="baseColumns"/>
        FROM user_order_refund_payment t
        where t.id_ = #{id}
    </select>

    <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.UserOrderRefundBillVo">
        SELECT
        <include refid="baseColumns" />
        FROM user_order_refund_payment t
    </select>

    <select id="getByTransNoOrOrderNo" resultMap="BaseResultMap">
        select t.*
        from user_order_refund_bill t
        <where>
            <if test="refundOrderNo != null and refundOrderNo != ''">
                and t.bill_no_ = #{refundOrderNo}
            </if>
            <if test="transNo != null and transNo != ''">
                and t.trans_no_ = #{transNo}
            </if>
        </where>
    </select>
</mapper>