WxOrderMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.miaxis.wx.mapper.WxOrderMapper">
  6. <resultMap type="WxOrder" id="WxOrderResult">
  7. <result property="id" column="id"/>
  8. <result property="goodsId" column="goods_id"/>
  9. <result property="goodsName" column="goods_name"/>
  10. <result property="userId" column="user_id"/>
  11. <result property="unionId" column="union_id"/>
  12. <result property="appOpenid" column="app_openid"/>
  13. <result property="xcxOpenid" column="xcx_openid"/>
  14. <result property="gzhOpenid" column="gzh_openid"/>
  15. <result property="outTradeNo" column="out_trade_no"/>
  16. <result property="outRefundNo" column="out_refund_no"/>
  17. <result property="refundReason" column="refund_reason"/>
  18. <result property="transactionId" column="transaction_id"/>
  19. <result property="tradeType" column="trade_type"/>
  20. <result property="tradeState" column="trade_state"/>
  21. <result property="tradeStateDesc" column="trade_state_desc"/>
  22. <result property="bankType" column="bank_type"/>
  23. <result property="attach" column="attach"/>
  24. <result property="successTime" column="success_time"/>
  25. <result property="total" column="total"/>
  26. <result property="payerTotal" column="payer_total"/>
  27. <result property="currency" column="currency"/>
  28. <result property="payerCurrency" column="payer_currency"/>
  29. <result property="orderStatus" column="order_status"/>
  30. <result property="phoneType" column="phone_type"/>
  31. <result property="foreType" column="fore_type"/>
  32. <result property="profitSharing" column="profit_sharing"/>
  33. <result property="createTime" column="create_time"/>
  34. <result property="updateTime" column="update_time"/>
  35. </resultMap>
  36. <sql id="selectWxOrderVo">
  37. select *
  38. from wx_order
  39. </sql>
  40. <select id="getByOutTradeNo" parameterType="string" resultType="com.miaxis.wx.domain.WxOrder">
  41. select *
  42. from wx_order
  43. where out_trade_no = #{outTradeNo}
  44. </select>
  45. <select id="selectWxOrderList" parameterType="WxOrder" resultMap="WxOrderResult">
  46. <include refid="selectWxOrderVo"/>
  47. <where>
  48. <if test="goodsId != null">and goods_id = #{goodsId}</if>
  49. <if test="goodsName != null and goodsName != ''">and goods_name like concat('%', #{goodsName}, '%')</if>
  50. <if test="userId != null">and user_id = #{userId}</if>
  51. <if test="unionId != null and unionId != ''">and union_id = #{unionId}</if>
  52. <if test="outTradeNo != null and outTradeNo != ''">and out_trade_no = #{outTradeNo}</if>
  53. <if test="outRefundNo != null and outRefundNo != ''">and out_refund_no = #{outRefundNo}</if>
  54. <if test="refundReason != null and refundReason != ''">and refund_reason = #{refundReason}</if>
  55. <if test="transactionId != null and transactionId != ''">and transaction_id = #{transactionId}</if>
  56. <if test="tradeType != null and tradeType != ''">and trade_type = #{tradeType}</if>
  57. <if test="tradeState != null and tradeState != ''">and trade_state = #{tradeState}</if>
  58. <if test="tradeStateDesc != null and tradeStateDesc != ''">and trade_state_desc = #{tradeStateDesc}</if>
  59. <if test="bankType != null and bankType != ''">and bank_type = #{bankType}</if>
  60. <if test="attach != null and attach != ''">and attach = #{attach}</if>
  61. <if test="successTime != null ">and success_time = #{successTime}</if>
  62. <if test="total != null ">and total = #{total}</if>
  63. <if test="payerTotal != null ">and payer_total = #{payerTotal}</if>
  64. <if test="currency != null and currency != ''">and currency = #{currency}</if>
  65. <if test="payerCurrency != null and payerCurrency != ''">and payer_currency = #{payerCurrency}</if>
  66. <if test="orderStatus != null and orderStatus != ''">and order_status = #{orderStatus}</if>
  67. <if test="profitSharing != null">and profit_sharing = #{profitSharing}</if>
  68. <if test="phoneType != null">and phone_type = #{phoneType}</if>
  69. <if test="foreType != null">and fore_type = #{foreType}</if>
  70. </where>
  71. </select>
  72. <select id="selectOrderList" resultType="com.miaxis.wx.domain.WxOrder">
  73. select * from wx_order
  74. where openid=#{openid} and trade_state ='SUCCESS'
  75. <if test="days != null and days != ''">
  76. and DATE_SUB(CURDATE(), INTERVAL #{days} DAY) &lt;= date(create_time)
  77. </if>
  78. <if test="orderStatus != null and orderStatus != ''">
  79. and order_status = #{orderStatus}
  80. </if>
  81. order by create_time desc
  82. </select>
  83. <select id="selectPcOrderList" resultType="com.miaxis.wx.domain.WxOrder">
  84. select * from wx_order
  85. where trade_state ='SUCCESS'
  86. <if test="outTradeNo != null and outTradeNo != ''">
  87. and out_trade_no = #{outTradeNo}
  88. </if>
  89. <if test="orderStatus != null and orderStatus != ''">
  90. and order_status = #{orderStatus}
  91. </if>
  92. <if test="goodsType != null and goodsType != ''">
  93. and goods_type = #{goodsType}
  94. </if>
  95. <if test="startTime != null">
  96. and DATE_FORMAT(create_time,'%Y-%m-%d')<![CDATA[ >= ]]> #{startTime}
  97. </if>
  98. <if test="endTime != null">
  99. and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ < ]]> #{endTime}
  100. </if>
  101. order by create_time desc
  102. </select>
  103. <select id="QuerySchoolOrderList" resultType="com.miaxis.wx.domain.WxOrder">
  104. select * from wx_order
  105. where trade_state ='SUCCESS'
  106. <if test="referralUserId != null and referralUserId != ''">
  107. and referral_user_id = #{referralUserId}
  108. </if>
  109. <if test="startTime != null">
  110. and DATE_FORMAT(create_time,'%Y-%m-%d')<![CDATA[ >= ]]> #{startTime}
  111. </if>
  112. <if test="endTime != null">
  113. and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ < ]]> #{endTime}
  114. </if>
  115. order by create_time desc
  116. </select>
  117. <select id="selectWxOrderByWaitProfit" resultType="com.miaxis.wx.domain.WxOrder">
  118. select * from wx_order where trade_state ='SUCCESS' and profit_sharing = 1
  119. <if test="nowDate != null"><!-- 开始时间检索 -->
  120. and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> #{nowDate}
  121. </if>
  122. order by success_time
  123. </select>
  124. </mapper>