|
@@ -1,86 +1,91 @@
|
|
|
<?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">
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.miaxis.wx.mapper.WxOrderMapper">
|
|
|
|
|
|
<resultMap type="WxOrder" id="WxOrderResult">
|
|
|
- <result property="id" column="id" />
|
|
|
- <result property="goodsId" column="goods_id" />
|
|
|
- <result property="goodsName" column="goods_name" />
|
|
|
- <result property="userId" column="user_id" />
|
|
|
- <result property="unionId" column="union_id" />
|
|
|
- <result property="appOpenid" column="app_openid" />
|
|
|
- <result property="xcxOpenid" column="xcx_openid" />
|
|
|
- <result property="gzhOpenid" column="gzh_openid" />
|
|
|
- <result property="outTradeNo" column="out_trade_no" />
|
|
|
- <result property="outRefundNo" column="out_refund_no" />
|
|
|
- <result property="refundReason" column="refund_reason" />
|
|
|
- <result property="transactionId" column="transaction_id" />
|
|
|
- <result property="tradeType" column="trade_type" />
|
|
|
- <result property="tradeState" column="trade_state" />
|
|
|
- <result property="tradeStateDesc" column="trade_state_desc" />
|
|
|
- <result property="bankType" column="bank_type" />
|
|
|
- <result property="attach" column="attach" />
|
|
|
- <result property="successTime" column="success_time" />
|
|
|
- <result property="total" column="total" />
|
|
|
- <result property="payerTotal" column="payer_total" />
|
|
|
- <result property="currency" column="currency" />
|
|
|
- <result property="payerCurrency" column="payer_currency" />
|
|
|
- <result property="orderStatus" column="order_status" />
|
|
|
- <result property="phoneType" column="phone_type" />
|
|
|
- <result property="foreType" column="fore_type" />
|
|
|
- <result property="createTime" column="create_time" />
|
|
|
- <result property="updateTime" column="update_time" />
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="goodsId" column="goods_id"/>
|
|
|
+ <result property="goodsName" column="goods_name"/>
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
+ <result property="unionId" column="union_id"/>
|
|
|
+ <result property="appOpenid" column="app_openid"/>
|
|
|
+ <result property="xcxOpenid" column="xcx_openid"/>
|
|
|
+ <result property="gzhOpenid" column="gzh_openid"/>
|
|
|
+ <result property="outTradeNo" column="out_trade_no"/>
|
|
|
+ <result property="outRefundNo" column="out_refund_no"/>
|
|
|
+ <result property="refundReason" column="refund_reason"/>
|
|
|
+ <result property="transactionId" column="transaction_id"/>
|
|
|
+ <result property="tradeType" column="trade_type"/>
|
|
|
+ <result property="tradeState" column="trade_state"/>
|
|
|
+ <result property="tradeStateDesc" column="trade_state_desc"/>
|
|
|
+ <result property="bankType" column="bank_type"/>
|
|
|
+ <result property="attach" column="attach"/>
|
|
|
+ <result property="successTime" column="success_time"/>
|
|
|
+ <result property="total" column="total"/>
|
|
|
+ <result property="payerTotal" column="payer_total"/>
|
|
|
+ <result property="currency" column="currency"/>
|
|
|
+ <result property="payerCurrency" column="payer_currency"/>
|
|
|
+ <result property="orderStatus" column="order_status"/>
|
|
|
+ <result property="phoneType" column="phone_type"/>
|
|
|
+ <result property="foreType" column="fore_type"/>
|
|
|
+ <result property="profitSharing" column="profit_sharing"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectWxOrderVo">
|
|
|
- select * from wx_order
|
|
|
+ select *
|
|
|
+ from wx_order
|
|
|
</sql>
|
|
|
|
|
|
<select id="getByOutTradeNo" parameterType="string" resultType="com.miaxis.wx.domain.WxOrder">
|
|
|
- select * from wx_order where out_trade_no =#{outTradeNo}
|
|
|
+ select *
|
|
|
+ from wx_order
|
|
|
+ where out_trade_no = #{outTradeNo}
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="selectWxOrderList" parameterType="WxOrder" resultMap="WxOrderResult">
|
|
|
<include refid="selectWxOrderVo"/>
|
|
|
<where>
|
|
|
- <if test="goodsId != null"> and goods_id = #{goodsId}</if>
|
|
|
- <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
|
|
|
- <if test="userId != null"> and user_id = #{userId}</if>
|
|
|
- <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
|
|
|
- <if test="outTradeNo != null and outTradeNo != ''"> and out_trade_no = #{outTradeNo}</if>
|
|
|
- <if test="outRefundNo != null and outRefundNo != ''"> and out_refund_no = #{outRefundNo}</if>
|
|
|
- <if test="refundReason != null and refundReason != ''"> and refund_reason = #{refundReason}</if>
|
|
|
- <if test="transactionId != null and transactionId != ''"> and transaction_id = #{transactionId}</if>
|
|
|
- <if test="tradeType != null and tradeType != ''"> and trade_type = #{tradeType}</if>
|
|
|
- <if test="tradeState != null and tradeState != ''"> and trade_state = #{tradeState}</if>
|
|
|
- <if test="tradeStateDesc != null and tradeStateDesc != ''"> and trade_state_desc = #{tradeStateDesc}</if>
|
|
|
- <if test="bankType != null and bankType != ''"> and bank_type = #{bankType}</if>
|
|
|
- <if test="attach != null and attach != ''"> and attach = #{attach}</if>
|
|
|
- <if test="successTime != null "> and success_time = #{successTime}</if>
|
|
|
- <if test="total != null "> and total = #{total}</if>
|
|
|
- <if test="payerTotal != null "> and payer_total = #{payerTotal}</if>
|
|
|
- <if test="currency != null and currency != ''"> and currency = #{currency}</if>
|
|
|
- <if test="payerCurrency != null and payerCurrency != ''"> and payer_currency = #{payerCurrency}</if>
|
|
|
- <if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if>
|
|
|
- <if test="phoneType != null"> and phone_type = #{phoneType}</if>
|
|
|
- <if test="foreType != null"> and fore_type = #{foreType}</if>
|
|
|
+ <if test="goodsId != null">and goods_id = #{goodsId}</if>
|
|
|
+ <if test="goodsName != null and goodsName != ''">and goods_name like concat('%', #{goodsName}, '%')</if>
|
|
|
+ <if test="userId != null">and user_id = #{userId}</if>
|
|
|
+ <if test="unionId != null and unionId != ''">and union_id = #{unionId}</if>
|
|
|
+ <if test="outTradeNo != null and outTradeNo != ''">and out_trade_no = #{outTradeNo}</if>
|
|
|
+ <if test="outRefundNo != null and outRefundNo != ''">and out_refund_no = #{outRefundNo}</if>
|
|
|
+ <if test="refundReason != null and refundReason != ''">and refund_reason = #{refundReason}</if>
|
|
|
+ <if test="transactionId != null and transactionId != ''">and transaction_id = #{transactionId}</if>
|
|
|
+ <if test="tradeType != null and tradeType != ''">and trade_type = #{tradeType}</if>
|
|
|
+ <if test="tradeState != null and tradeState != ''">and trade_state = #{tradeState}</if>
|
|
|
+ <if test="tradeStateDesc != null and tradeStateDesc != ''">and trade_state_desc = #{tradeStateDesc}</if>
|
|
|
+ <if test="bankType != null and bankType != ''">and bank_type = #{bankType}</if>
|
|
|
+ <if test="attach != null and attach != ''">and attach = #{attach}</if>
|
|
|
+ <if test="successTime != null ">and success_time = #{successTime}</if>
|
|
|
+ <if test="total != null ">and total = #{total}</if>
|
|
|
+ <if test="payerTotal != null ">and payer_total = #{payerTotal}</if>
|
|
|
+ <if test="currency != null and currency != ''">and currency = #{currency}</if>
|
|
|
+ <if test="payerCurrency != null and payerCurrency != ''">and payer_currency = #{payerCurrency}</if>
|
|
|
+ <if test="orderStatus != null and orderStatus != ''">and order_status = #{orderStatus}</if>
|
|
|
+ <if test="profitSharing != null">and profit_sharing = #{profitSharing}</if>
|
|
|
+ <if test="phoneType != null">and phone_type = #{phoneType}</if>
|
|
|
+ <if test="foreType != null">and fore_type = #{foreType}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="selectOrderList" resultType="com.miaxis.wx.domain.WxOrder">
|
|
|
select * from wx_order
|
|
|
- where openid=#{openid} and trade_state ='SUCCESS'
|
|
|
+ where openid=#{openid} and trade_state ='SUCCESS'
|
|
|
<if test="days != null and days != ''">
|
|
|
- and DATE_SUB(CURDATE(), INTERVAL #{days} DAY) <= date(create_time)
|
|
|
+ and DATE_SUB(CURDATE(), INTERVAL #{days} DAY) <= date(create_time)
|
|
|
</if>
|
|
|
<if test="orderStatus != null and orderStatus != ''">
|
|
|
- and order_status = #{orderStatus}
|
|
|
+ and order_status = #{orderStatus}
|
|
|
</if>
|
|
|
- order by create_time desc
|
|
|
+ order by create_time desc
|
|
|
</select>
|
|
|
|
|
|
|
|
@@ -88,13 +93,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
select * from wx_order
|
|
|
where trade_state ='SUCCESS'
|
|
|
<if test="outTradeNo != null and outTradeNo != ''">
|
|
|
- and out_trade_no = #{outTradeNo}
|
|
|
+ and out_trade_no = #{outTradeNo}
|
|
|
</if>
|
|
|
<if test="orderStatus != null and orderStatus != ''">
|
|
|
- and order_status = #{orderStatus}
|
|
|
+ and order_status = #{orderStatus}
|
|
|
</if>
|
|
|
<if test="goodsType != null and goodsType != ''">
|
|
|
- and goods_type = #{goodsType}
|
|
|
+ and goods_type = #{goodsType}
|
|
|
</if>
|
|
|
<if test="startTime != null">
|
|
|
and DATE_FORMAT(create_time,'%Y-%m-%d')<![CDATA[ >= ]]> #{startTime}
|
|
@@ -110,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
select * from wx_order
|
|
|
where trade_state ='SUCCESS'
|
|
|
<if test="referralUserId != null and referralUserId != ''">
|
|
|
- and referral_user_id = #{referralUserId}
|
|
|
+ and referral_user_id = #{referralUserId}
|
|
|
</if>
|
|
|
<if test="startTime != null">
|
|
|
and DATE_FORMAT(create_time,'%Y-%m-%d')<![CDATA[ >= ]]> #{startTime}
|
|
@@ -121,4 +126,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
order by create_time desc
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
+ <select id="selectWxOrderByWaitProfit" resultType="com.miaxis.wx.domain.WxOrder">
|
|
|
+ select * from wx_order where trade_state ='SUCCESS' and profit_sharing = 1
|
|
|
+ <if test="nowDate != null"><!-- 开始时间检索 -->
|
|
|
+ and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> #{nowDate}
|
|
|
+ </if>
|
|
|
+ order by success_time
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
</mapper>
|