<?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.tt.mapper.TtOrderMapper">

    <resultMap type="TtOrder" id="TtOrderResult">
        <result property="id"    column="id"    />
        <result property="cpOrderno"    column="cp_orderno"    />
        <result property="outRefundNo"    column="out_refund_no"    />
        <result property="way"    column="way"    />
        <result property="refundReason"    column="refund_reason"    />
        <result property="channelNo"    column="channel_no"    />
        <result property="paymentOrderNo"    column="payment_order_no"    />
        <result property="tradeType"    column="trade_type"    />
        <result property="status"    column="status"    />
        <result property="bankType"    column="bank_type"    />
        <result property="cpExtra"    column="cp_extra"    />
        <result property="paidAt"    column="paid_at"    />
        <result property="itemId"    column="item_id"    />
        <result property="sellerUid"    column="seller_uid"    />
        <result property="unionId"    column="union_id"    />
        <result property="xcxOpenid"    column="xcx_openid"    />
        <result property="appOpenid"    column="app_openid"    />
        <result property="totalAmount"    column="total_amount"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectTtOrderVo">
        select * from tt_order
    </sql>

    <select id="selectTtOrderList" parameterType="TtOrder" resultMap="TtOrderResult">
        <include refid="selectTtOrderVo"/>
        <where>
            <if test="cpOrderno != null  and cpOrderno != ''"> and cp_orderno = #{cpOrderno}</if>
            <if test="outRefundNo != null  and outRefundNo != ''"> and out_refund_no = #{outRefundNo}</if>
            <if test="way != null  and way != ''"> and way = #{way}</if>
            <if test="refundReason != null  and refundReason != ''"> and refund_reason = #{refundReason}</if>
            <if test="channelNo != null  and channelNo != ''"> and channel_no = #{channelNo}</if>
            <if test="paymentOrderNo != null  and paymentOrderNo != ''"> and payment_order_no = #{paymentOrderNo}</if>
            <if test="tradeType != null  and tradeType != ''"> and trade_type = #{tradeType}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="bankType != null  and bankType != ''"> and bank_type = #{bankType}</if>
            <if test="cpExtra != null  and cpExtra != ''"> and cp_extra = #{cpExtra}</if>
            <if test="paidAt != null "> and paid_at = #{paidAt}</if>
            <if test="itemId != null  and itemId != ''"> and item_id = #{itemId}</if>
            <if test="sellerUid != null  and sellerUid != ''"> and seller_uid = #{sellerUid}</if>
            <if test="unionId != null  and unionId != ''"> and union_id = #{unionId}</if>
            <if test="xcxOpenid != null  and xcxOpenid != ''"> and xcx_openid = #{xcxOpenid}</if>
            <if test="appOpenid != null  and appOpenid != ''"> and app_openid = #{appOpenid}</if>
            <if test="totalAmount != null "> and total_amount = #{totalAmount}</if>
        </where>
    </select>

</mapper>
