<?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.mall.order.mapper.PaymentInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.order.domain.entity.PaymentInfo">
        <id column="id" property="id"/>
        <id column="order_sn" property="orderSn"/>
        <id column="order_id" property="orderId"/>
        <id column="alipay_trade_no" property="alipayTradeNo"/>
        <id column="total_amount" property="totalAmount"/>
        <id column="subject" property="subject"/>
        <id column="payment_status" property="paymentStatus"/>
        <id column="create_time" property="createTime"/>
        <id column="confirm_time" property="confirmTime"/>
        <id column="callback_content" property="callbackContent"/>
        <id column="callback_time" property="callbackTime"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,order_sn,order_id,alipay_trade_no,total_amount,subject,payment_status,create_time,confirm_time,callback_content,callback_time
    </sql>

    <!-- 分页查询支付信息表内容 -->
    <select id="selectListByPage" resultType="com.mall.order.domain.vo.PaymentInfoVo">
        select
        <include refid="Base_Column_List"/>
        from oms_payment_info
        <where>
            <if test="dto.id != null and dto.id != ''">
                and id like CONCAT('%',#{dto.id},'%')
            </if>
            <if test="dto.orderSn != null and dto.orderSn != ''">
                and order_sn like CONCAT('%',#{dto.orderSn},'%')
            </if>
            <if test="dto.orderId != null and dto.orderId != ''">
                and order_id like CONCAT('%',#{dto.orderId},'%')
            </if>
            <if test="dto.alipayTradeNo != null and dto.alipayTradeNo != ''">
                and alipay_trade_no like CONCAT('%',#{dto.alipayTradeNo},'%')
            </if>
            <if test="dto.totalAmount != null and dto.totalAmount != ''">
                and total_amount like CONCAT('%',#{dto.totalAmount},'%')
            </if>
            <if test="dto.subject != null and dto.subject != ''">
                and subject like CONCAT('%',#{dto.subject},'%')
            </if>
            <if test="dto.paymentStatus != null and dto.paymentStatus != ''">
                and payment_status like CONCAT('%',#{dto.paymentStatus},'%')
            </if>
            <if test="dto.createTime != null and dto.createTime != ''">
                and create_time like CONCAT('%',#{dto.createTime},'%')
            </if>
            <if test="dto.confirmTime != null and dto.confirmTime != ''">
                and confirm_time like CONCAT('%',#{dto.confirmTime},'%')
            </if>
            <if test="dto.callbackContent != null and dto.callbackContent != ''">
                and callback_content like CONCAT('%',#{dto.callbackContent},'%')
            </if>
            <if test="dto.callbackTime != null and dto.callbackTime != ''">
                and callback_time like CONCAT('%',#{dto.callbackTime},'%')
            </if>
        </where>
    </select>

</mapper>
