<?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.nova.sankuai.infra.mapper.AlipayOrderInfoMapper">
|
<resultMap id="BaseResultMap" type="com.nova.sankuai.domain.entity.AlipayOrderInfo">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
-->
|
<id column="id" jdbcType="BIGINT" property="id" />
|
<result column="alipay_serial" jdbcType="VARCHAR" property="alipaySerial" />
|
<result column="channel_id" jdbcType="VARCHAR" property="channelId" />
|
<result column="order_id" jdbcType="VARCHAR" property="orderId" />
|
<result column="order_subject" jdbcType="VARCHAR" property="orderSubject" />
|
<result column="order_body" jdbcType="VARCHAR" property="orderBody" />
|
<result column="order_status" jdbcType="VARCHAR" property="orderStatus" />
|
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
|
<result column="gmt_payment" jdbcType="TIMESTAMP" property="gmtPayment" />
|
<result column="gmt_refund" jdbcType="TIMESTAMP" property="gmtRefund" />
|
<result column="gmt_close" jdbcType="TIMESTAMP" property="gmtClose" />
|
<result column="app_id" jdbcType="VARCHAR" property="appId" />
|
<result column="buyer_id" jdbcType="VARCHAR" property="buyerId" />
|
<result column="seller_id" jdbcType="VARCHAR" property="sellerId" />
|
<result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
|
<result column="receipt_amount" jdbcType="DECIMAL" property="receiptAmount" />
|
<result column="point_amount" jdbcType="DECIMAL" property="pointAmount" />
|
<result column="buyer_pay_amount" jdbcType="DECIMAL" property="buyerPayAmount" />
|
<result column="invoice_amount" jdbcType="DECIMAL" property="invoiceAmount" />
|
<result column="refund_fee" jdbcType="DECIMAL" property="refundFee" />
|
<result column="record_vers" jdbcType="INTEGER" property="recordVers" />
|
<result column="notify_url" jdbcType="VARCHAR" property="notifyUrl" />
|
</resultMap>
|
<sql id="Base_Column_List">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
-->
|
id, alipay_serial, channel_id, order_id, order_subject, order_body, order_status, gmt_create, gmt_payment,
|
gmt_refund, gmt_close, app_id, buyer_id, seller_id, total_amount, receipt_amount,
|
point_amount, buyer_pay_amount, invoice_amount, refund_fee, record_vers, notify_url
|
</sql>
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
-->
|
select
|
<include refid="Base_Column_List" />
|
from alipay_order_info
|
where id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
-->
|
delete from alipay_order_info
|
where id = #{id,jdbcType=BIGINT}
|
</delete>
|
<insert id="insert" parameterType="com.nova.sankuai.domain.entity.AlipayOrderInfo">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
-->
|
insert into alipay_order_info (id, alipay_serial, channel_id, order_id,
|
order_subject, order_body, order_status,
|
gmt_create, gmt_payment, gmt_refund,
|
gmt_close, app_id, buyer_id,
|
seller_id, total_amount, receipt_amount,
|
point_amount, buyer_pay_amount, invoice_amount,
|
refund_fee, record_vers, notify_url)
|
values (#{id,jdbcType=BIGINT}, #{alipaySerial,jdbcType=VARCHAR}, #{channelId,jdbcType=VARCHAR},
|
#{orderId,jdbcType=VARCHAR},
|
#{orderSubject,jdbcType=VARCHAR}, #{orderBody,jdbcType=VARCHAR}, #{orderStatus,jdbcType=VARCHAR},
|
#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtPayment,jdbcType=TIMESTAMP}, #{gmtRefund,jdbcType=TIMESTAMP},
|
#{gmtClose,jdbcType=TIMESTAMP}, #{appId,jdbcType=VARCHAR}, #{buyerId,jdbcType=VARCHAR},
|
#{sellerId,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{receiptAmount,jdbcType=DECIMAL},
|
#{pointAmount,jdbcType=DECIMAL}, #{buyerPayAmount,jdbcType=DECIMAL}, #{invoiceAmount,jdbcType=DECIMAL},
|
#{refundFee,jdbcType=DECIMAL}, #{recordVers,jdbcType=INTEGER}, #{notifyUrl})
|
</insert>
|
<insert id="insertSelective" parameterType="com.nova.sankuai.domain.entity.AlipayOrderInfo">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
-->
|
insert into alipay_order_info
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
id,
|
</if>
|
<if test="alipaySerial != null">
|
alipay_serial,
|
</if>
|
<if test="channelId != null">
|
channel_id,
|
</if>
|
<if test="orderId != null">
|
order_id,
|
</if>
|
<if test="orderSubject != null">
|
order_subject,
|
</if>
|
<if test="orderBody != null">
|
order_body,
|
</if>
|
<if test="orderStatus != null">
|
order_status,
|
</if>
|
<if test="gmtCreate != null">
|
gmt_create,
|
</if>
|
<if test="gmtPayment != null">
|
gmt_payment,
|
</if>
|
<if test="gmtRefund != null">
|
gmt_refund,
|
</if>
|
<if test="gmtClose != null">
|
gmt_close,
|
</if>
|
<if test="appId != null">
|
app_id,
|
</if>
|
<if test="buyerId != null">
|
buyer_id,
|
</if>
|
<if test="sellerId != null">
|
seller_id,
|
</if>
|
<if test="totalAmount != null">
|
total_amount,
|
</if>
|
<if test="receiptAmount != null">
|
receipt_amount,
|
</if>
|
<if test="pointAmount != null">
|
point_amount,
|
</if>
|
<if test="buyerPayAmount != null">
|
buyer_pay_amount,
|
</if>
|
<if test="invoiceAmount != null">
|
invoice_amount,
|
</if>
|
<if test="refundFee != null">
|
refund_fee,
|
</if>
|
<if test="recordVers != null">
|
record_vers,
|
</if>
|
<if test="notifyUrl != null">
|
notify_url,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
#{id,jdbcType=BIGINT},
|
</if>
|
<if test="alipaySerial != null">
|
#{alipaySerial},
|
</if>
|
<if test="channelId != null">
|
#{channelId,jdbcType=VARCHAR},
|
</if>
|
<if test="orderId != null">
|
#{orderId,jdbcType=VARCHAR},
|
</if>
|
<if test="orderSubject != null">
|
#{orderSubject,jdbcType=VARCHAR},
|
</if>
|
<if test="orderBody != null">
|
#{orderBody,jdbcType=VARCHAR},
|
</if>
|
<if test="orderStatus != null">
|
#{orderStatus,jdbcType=VARCHAR},
|
</if>
|
<if test="gmtCreate != null">
|
#{gmtCreate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="gmtPayment != null">
|
#{gmtPayment,jdbcType=TIMESTAMP},
|
</if>
|
<if test="gmtRefund != null">
|
#{gmtRefund,jdbcType=TIMESTAMP},
|
</if>
|
<if test="gmtClose != null">
|
#{gmtClose,jdbcType=TIMESTAMP},
|
</if>
|
<if test="appId != null">
|
#{appId,jdbcType=VARCHAR},
|
</if>
|
<if test="buyerId != null">
|
#{buyerId,jdbcType=VARCHAR},
|
</if>
|
<if test="sellerId != null">
|
#{sellerId,jdbcType=VARCHAR},
|
</if>
|
<if test="totalAmount != null">
|
#{totalAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="receiptAmount != null">
|
#{receiptAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="pointAmount != null">
|
#{pointAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="buyerPayAmount != null">
|
#{buyerPayAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="invoiceAmount != null">
|
#{invoiceAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="refundFee != null">
|
#{refundFee,jdbcType=DECIMAL},
|
</if>
|
<if test="recordVers != null">
|
#{recordVers,jdbcType=INTEGER},
|
</if>
|
<if test="notifyUrl != null">
|
#{notifyUrl},
|
</if>
|
</trim>
|
</insert>
|
|
<insert id="insertSelectiveWithVers" parameterType="com.nova.sankuai.domain.entity.AlipayOrderInfo">
|
insert into alipay_order_info (
|
id, channel_id, order_id, order_subject,
|
order_body, gmt_create, order_status, app_id,
|
record_vers, notify_url, total_amount)
|
select #{inst.id},
|
#{inst.channelId},
|
#{inst.orderId},
|
#{inst.orderSubject},
|
#{inst.orderBody},
|
#{inst.gmtCreate},
|
#{inst.orderStatus},
|
#{inst.appId},
|
max(record_vers) + 1,
|
#{inst.notifyUrl},
|
#{inst.totalAmount}
|
from alipay_order_info
|
where channel_id = #{inst.channelId} and gmt_create between #{from} and #{to}
|
group by channel_id
|
having max(record_vers) = #{inst.recordVers}
|
</insert>
|
|
<update id="updateByOrderSelective" parameterType="com.nova.sankuai.domain.entity.AlipayOrderInfo">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
-->
|
update alipay_order_info
|
<set>
|
<if test="alipaySerial != null">
|
alipay_serial = #{alipaySerial},
|
</if>
|
<if test="orderSubject != null">
|
order_subject = #{orderSubject,jdbcType=VARCHAR},
|
</if>
|
<if test="orderBody != null">
|
order_body = #{orderBody,jdbcType=VARCHAR},
|
</if>
|
<if test="orderStatus != null">
|
order_status = #{orderStatus,jdbcType=VARCHAR},
|
</if>
|
<if test="gmtCreate != null">
|
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="gmtPayment != null">
|
gmt_payment = #{gmtPayment,jdbcType=TIMESTAMP},
|
</if>
|
<if test="gmtRefund != null">
|
gmt_refund = #{gmtRefund,jdbcType=TIMESTAMP},
|
</if>
|
<if test="gmtClose != null">
|
gmt_close = #{gmtClose,jdbcType=TIMESTAMP},
|
</if>
|
<if test="appId != null">
|
app_id = #{appId,jdbcType=VARCHAR},
|
</if>
|
<if test="buyerId != null">
|
buyer_id = #{buyerId,jdbcType=VARCHAR},
|
</if>
|
<if test="sellerId != null">
|
seller_id = #{sellerId,jdbcType=VARCHAR},
|
</if>
|
<if test="totalAmount != null">
|
total_amount = #{totalAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="receiptAmount != null">
|
receipt_amount = #{receiptAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="pointAmount != null">
|
point_amount = #{pointAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="buyerPayAmount != null">
|
buyer_pay_amount = #{buyerPayAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="invoiceAmount != null">
|
invoice_amount = #{invoiceAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="refundFee != null">
|
refund_fee = #{refundFee,jdbcType=DECIMAL},
|
</if>
|
<if test="recordVers != null">
|
record_vers = #{recordVers,jdbcType=INTEGER},
|
</if>
|
<if test="notifyUrl != null">
|
notify_url = #{notifyUrl},
|
</if>
|
</set>
|
where order_id = #{orderId} and channel_id = #{channelId}
|
</update>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.nova.sankuai.domain.entity.AlipayOrderInfo">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
-->
|
update alipay_order_info
|
<set>
|
<if test="alipaySerial != null">
|
alipay_serial = #{alipaySerial},
|
</if>
|
<if test="channelId != null">
|
channel_id = #{channelId,jdbcType=VARCHAR},
|
</if>
|
<if test="orderId != null">
|
order_id = #{orderId,jdbcType=VARCHAR},
|
</if>
|
<if test="orderSubject != null">
|
order_subject = #{orderSubject,jdbcType=VARCHAR},
|
</if>
|
<if test="orderBody != null">
|
order_body = #{orderBody,jdbcType=VARCHAR},
|
</if>
|
<if test="orderStatus != null">
|
order_status = #{orderStatus,jdbcType=VARCHAR},
|
</if>
|
<if test="gmtCreate != null">
|
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="gmtPayment != null">
|
gmt_payment = #{gmtPayment,jdbcType=TIMESTAMP},
|
</if>
|
<if test="gmtRefund != null">
|
gmt_refund = #{gmtRefund,jdbcType=TIMESTAMP},
|
</if>
|
<if test="gmtClose != null">
|
gmt_close = #{gmtClose,jdbcType=TIMESTAMP},
|
</if>
|
<if test="appId != null">
|
app_id = #{appId,jdbcType=VARCHAR},
|
</if>
|
<if test="buyerId != null">
|
buyer_id = #{buyerId,jdbcType=VARCHAR},
|
</if>
|
<if test="sellerId != null">
|
seller_id = #{sellerId,jdbcType=VARCHAR},
|
</if>
|
<if test="totalAmount != null">
|
total_amount = #{totalAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="receiptAmount != null">
|
receipt_amount = #{receiptAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="pointAmount != null">
|
point_amount = #{pointAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="buyerPayAmount != null">
|
buyer_pay_amount = #{buyerPayAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="invoiceAmount != null">
|
invoice_amount = #{invoiceAmount,jdbcType=DECIMAL},
|
</if>
|
<if test="refundFee != null">
|
refund_fee = #{refundFee,jdbcType=DECIMAL},
|
</if>
|
<if test="recordVers != null">
|
record_vers = #{recordVers,jdbcType=INTEGER},
|
</if>
|
<if test="notifyUrl != null">
|
notify_url = #{notifyUrl},
|
</if>
|
</set>
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateByPrimaryKey" parameterType="com.nova.sankuai.domain.entity.AlipayOrderInfo">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
-->
|
update alipay_order_info
|
set alipay_serial = #{alipaySerial},
|
channel_id = #{channelId,jdbcType=VARCHAR},
|
order_id = #{orderId,jdbcType=VARCHAR},
|
order_subject = #{orderSubject,jdbcType=VARCHAR},
|
order_body = #{orderBody,jdbcType=VARCHAR},
|
order_status = #{orderStatus,jdbcType=VARCHAR},
|
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
|
gmt_payment = #{gmtPayment,jdbcType=TIMESTAMP},
|
gmt_refund = #{gmtRefund,jdbcType=TIMESTAMP},
|
gmt_close = #{gmtClose,jdbcType=TIMESTAMP},
|
app_id = #{appId,jdbcType=VARCHAR},
|
buyer_id = #{buyerId,jdbcType=VARCHAR},
|
seller_id = #{sellerId,jdbcType=VARCHAR},
|
total_amount = #{totalAmount,jdbcType=DECIMAL},
|
receipt_amount = #{receiptAmount,jdbcType=DECIMAL},
|
point_amount = #{pointAmount,jdbcType=DECIMAL},
|
buyer_pay_amount = #{buyerPayAmount,jdbcType=DECIMAL},
|
invoice_amount = #{invoiceAmount,jdbcType=DECIMAL},
|
refund_fee = #{refundFee,jdbcType=DECIMAL},
|
record_vers = #{recordVers,jdbcType=INTEGER},
|
notify_url = #{notifyUrl}
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
<select id="selectByChannelIdAndOrderId" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from alipay_order_info
|
where channel_id = #{channelId}
|
and order_id = #{orderId}
|
</select>
|
<select id="checkChannelIdTradingLimit" resultType="com.nova.sankuai.domain.dto.AlipayChannelDailyLimitDTO">
|
select max(a.record_vers) vers, sum(a.total_amount) total
|
from alipay_order_info a
|
where a.channel_id = #{channelId}
|
and a.order_status in ('WAIT_BUYER_PAY', 'TRADE_SUCCESS', 'TRADE_FINISHED', 'TRADE_CLOSED')
|
and a.gmt_create between #{from} and #{to}
|
group by a.channel_id
|
having sum(a.total_amount) <= #{dailyLimit}
|
</select>
|
<select id="checkTodayHasTradeOrder" resultType="java.lang.Integer">
|
select count(1) from alipay_order_info
|
where channel_id = #{channelId}
|
and gmt_create between #{from} and #{to}
|
</select>
|
|
</mapper>
|