123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <?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.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="profitSharing" column="profit_sharing"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- </resultMap>
- <sql id="selectWxOrderVo">
- 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>
- <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="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'
- <if test="days != null and days != ''">
- and DATE_SUB(CURDATE(), INTERVAL #{days} DAY) <= date(create_time)
- </if>
- <if test="orderStatus != null and orderStatus != ''">
- and order_status = #{orderStatus}
- </if>
- order by create_time desc
- </select>
- <select id="selectPcOrderList" resultType="com.miaxis.wx.domain.WxOrder">
- select * from wx_order
- where trade_state ='SUCCESS'
- <if test="outTradeNo != null and outTradeNo != ''">
- and out_trade_no = #{outTradeNo}
- </if>
- <if test="orderStatus != null and orderStatus != ''">
- and order_status = #{orderStatus}
- </if>
- <if test="goodsType != null and goodsType != ''">
- and goods_type = #{goodsType}
- </if>
- <if test="startTime != null">
- and DATE_FORMAT(create_time,'%Y-%m-%d')<![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null">
- and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ < ]]> #{endTime}
- </if>
- order by create_time desc
- </select>
- <select id="QuerySchoolOrderList" resultType="com.miaxis.wx.domain.WxOrder">
- select * from wx_order
- where trade_state ='SUCCESS'
- <if test="referralUserId != null and referralUserId != ''">
- and referral_user_id = #{referralUserId}
- </if>
- <if test="startTime != null">
- and DATE_FORMAT(create_time,'%Y-%m-%d')<![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null">
- and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ < ]]> #{endTime}
- </if>
- 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>
|