|
|
@@ -0,0 +1,170 @@
|
|
|
+<?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="org.dromara.business.mapper.PayOrderMapper">
|
|
|
+
|
|
|
+ <!-- 动态插入(非空字段) -->
|
|
|
+ <insert id="insertPayOrder" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ INSERT INTO pay_order
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="outTradeNo != null">out_trade_no,</if>
|
|
|
+ <if test="subject != null">subject,</if>
|
|
|
+ <if test="body != null">body,</if>
|
|
|
+ <if test="totalAmount != null">total_amount,</if>
|
|
|
+ <if test="currency != null">currency,</if>
|
|
|
+ <if test="userId != null">user_id,</if>
|
|
|
+ <if test="bizType != null">biz_type,</if>
|
|
|
+ <if test="bizId != null">biz_id,</if>
|
|
|
+ <if test="tradeNo != null">trade_no,</if>
|
|
|
+ <if test="appId != null">app_id,</if>
|
|
|
+ <if test="sellerId != null">seller_id,</if>
|
|
|
+ <if test="status != null">status,</if>
|
|
|
+ <if test="payTime != null">pay_time,</if>
|
|
|
+ <if test="notifyTime != null">notify_time,</if>
|
|
|
+ <if test="notifyType != null">notify_type,</if>
|
|
|
+ <if test="tradeStatus != null">trade_status,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="productId != null">product_id,</if>
|
|
|
+ <if test="relatedItemId != null">related_item_id,</if>
|
|
|
+ <if test="payUrl != null">pay_url,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="outTradeNo != null">#{outTradeNo},</if>
|
|
|
+ <if test="subject != null">#{subject},</if>
|
|
|
+ <if test="body != null">#{body},</if>
|
|
|
+ <if test="totalAmount != null">#{totalAmount},</if>
|
|
|
+ <if test="currency != null">#{currency},</if>
|
|
|
+ <if test="userId != null">#{userId},</if>
|
|
|
+ <if test="bizType != null">#{bizType},</if>
|
|
|
+ <if test="bizId != null">#{bizId},</if>
|
|
|
+ <if test="tradeNo != null">#{tradeNo},</if>
|
|
|
+ <if test="appId != null">#{appId},</if>
|
|
|
+ <if test="sellerId != null">#{sellerId},</if>
|
|
|
+ <if test="status != null">#{status},</if>
|
|
|
+ <if test="payTime != null">#{payTime},</if>
|
|
|
+ <if test="notifyTime != null">#{notifyTime},</if>
|
|
|
+ <if test="notifyType != null">#{notifyType},</if>
|
|
|
+ <if test="tradeStatus != null">#{tradeStatus},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="productId != null">#{productId},</if>
|
|
|
+ <if test="relatedItemId != null">#{relatedItemId},</if>
|
|
|
+ <if test="payUrl != null">#{payUrl},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 根据主键更新(仅非空字段) -->
|
|
|
+ <update id="updatePayOrder">
|
|
|
+ UPDATE pay_order
|
|
|
+ <set>
|
|
|
+ <if test="outTradeNo != null">out_trade_no = #{outTradeNo},</if>
|
|
|
+ <if test="subject != null">subject = #{subject},</if>
|
|
|
+ <if test="body != null">body = #{body},</if>
|
|
|
+ <if test="totalAmount != null">total_amount = #{totalAmount},</if>
|
|
|
+ <if test="currency != null">currency = #{currency},</if>
|
|
|
+ <if test="userId != null">user_id = #{userId},</if>
|
|
|
+ <if test="bizType != null">biz_type = #{bizType},</if>
|
|
|
+ <if test="bizId != null">biz_id = #{bizId},</if>
|
|
|
+ <if test="tradeNo != null">trade_no = #{tradeNo},</if>
|
|
|
+ <if test="appId != null">app_id = #{appId},</if>
|
|
|
+ <if test="sellerId != null">seller_id = #{sellerId},</if>
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
+ <if test="payTime != null">pay_time = #{payTime},</if>
|
|
|
+ <if test="notifyTime != null">notify_time = #{notifyTime},</if>
|
|
|
+ <if test="notifyType != null">notify_type = #{notifyType},</if>
|
|
|
+ <if test="tradeStatus != null">trade_status = #{tradeStatus},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="productId != null">product_id = #{productId},</if>
|
|
|
+ <if test="relatedItemId != null">related_item_id = #{relatedItemId},</if>
|
|
|
+ <if test="payUrl != null">pay_url = #{payUrl},</if>
|
|
|
+ </set>
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 根据 out_trade_no 更新 -->
|
|
|
+ <update id="updatePayOrderByOutTradeNo">
|
|
|
+ UPDATE pay_order
|
|
|
+ <set>
|
|
|
+ <if test="subject != null">subject = #{subject},</if>
|
|
|
+ <if test="body != null">body = #{body},</if>
|
|
|
+ <if test="totalAmount != null">total_amount = #{totalAmount},</if>
|
|
|
+ <if test="currency != null">currency = #{currency},</if>
|
|
|
+ <if test="userId != null">user_id = #{userId},</if>
|
|
|
+ <if test="bizType != null">biz_type = #{bizType},</if>
|
|
|
+ <if test="bizId != null">biz_id = #{bizId},</if>
|
|
|
+ <if test="tradeNo != null">trade_no = #{tradeNo},</if>
|
|
|
+ <if test="appId != null">app_id = #{appId},</if>
|
|
|
+ <if test="sellerId != null">seller_id = #{sellerId},</if>
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
+ <if test="payTime != null">pay_time = #{payTime},</if>
|
|
|
+ <if test="notifyTime != null">notify_time = #{notifyTime},</if>
|
|
|
+ <if test="notifyType != null">notify_type = #{notifyType},</if>
|
|
|
+ <if test="tradeStatus != null">trade_status = #{tradeStatus},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="productId != null">product_id = #{productId},</if>
|
|
|
+ <if test="relatedItemId != null">related_item_id = #{relatedItemId},</if>
|
|
|
+ <if test="payUrl != null">pay_url = #{payUrl},</if>
|
|
|
+ </set>
|
|
|
+ WHERE out_trade_no = #{outTradeNo}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 根据主键查询 -->
|
|
|
+ <select id="selectPayOrderById" parameterType="java.lang.Long" resultType="org.dromara.business.domain.vo.PayOrderVo">
|
|
|
+ SELECT
|
|
|
+ id, out_trade_no, subject, body, total_amount, currency,
|
|
|
+ user_id, biz_type, biz_id, trade_no, app_id, seller_id,
|
|
|
+ status, pay_time, notify_time, notify_type, trade_status,
|
|
|
+ create_time, update_time, product_id, related_item_id, pay_url
|
|
|
+ FROM pay_order
|
|
|
+ WHERE id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据商户订单号查询 -->
|
|
|
+ <select id="selectPayOrderByOutTradeNo" parameterType="java.lang.String" resultType="org.dromara.business.domain.vo.PayOrderVo">
|
|
|
+ SELECT
|
|
|
+ id, out_trade_no, subject, body, total_amount, currency,
|
|
|
+ user_id, biz_type, biz_id, trade_no, app_id, seller_id,
|
|
|
+ status, pay_time, notify_time, notify_type, trade_status,
|
|
|
+ create_time, update_time, product_id, related_item_id, pay_url
|
|
|
+ FROM pay_order
|
|
|
+ WHERE out_trade_no = #{outTradeNo}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询所有(支持条件扩展) -->
|
|
|
+ <select id="selectPayOrderAll" resultType="org.dromara.business.domain.vo.PayOrderVo">
|
|
|
+ SELECT
|
|
|
+ a.id, a.out_trade_no, a.subject, a.body, a.total_amount, a.currency,
|
|
|
+ a.user_id, a.biz_type, a.biz_id, a.trade_no, a.app_id, a.seller_id,
|
|
|
+ a.status, a.pay_time, a.notify_time, a.notify_type, a.trade_status,
|
|
|
+ a.create_time, a.update_time, a.product_id, a.related_item_id, a.pay_url,b.phone,b.nick_name
|
|
|
+ FROM pay_order a left join user b on a.user_id=b.id
|
|
|
+ ${ew.customSqlSegment}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <delete id="deletePayOrderById">
|
|
|
+ DELETE FROM pay_order
|
|
|
+ <where>
|
|
|
+ id IN
|
|
|
+ <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
+ <if test="id > 0">
|
|
|
+ #{id}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </where>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="selectPayOrderList" resultType="org.dromara.business.domain.vo.PayOrderVo">
|
|
|
+ SELECT
|
|
|
+ id, out_trade_no, subject, body, total_amount, currency,
|
|
|
+ user_id, biz_type, biz_id, trade_no, app_id, seller_id,
|
|
|
+ status, pay_time, notify_time, notify_type, trade_status,
|
|
|
+ create_time, update_time, product_id, related_item_id, pay_url
|
|
|
+ FROM pay_order
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+</mapper>
|