WxOrderMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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="outTradeNo" column="out_trade_no" />
  9. <result property="transactionId" column="transaction_id" />
  10. <result property="tradeType" column="trade_type" />
  11. <result property="tradeState" column="trade_state" />
  12. <result property="tradeStateDesc" column="trade_state_desc" />
  13. <result property="bankType" column="bank_type" />
  14. <result property="attach" column="attach" />
  15. <result property="successTime" column="success_time" />
  16. <result property="openid" column="openid" />
  17. <result property="goodsName" column="goods_name" />
  18. <result property="total" column="total" />
  19. <result property="payerTotal" column="payer_total" />
  20. <result property="currency" column="currency" />
  21. <result property="payerCurrency" column="payer_currency" />
  22. <result property="deviceId" column="device_id" />
  23. <result property="seat" column="seat" />
  24. <result property="reservedPhone" column="reserved_phone" />
  25. <result property="acceptChangeSeat" column="accept_change_seat" />
  26. <result property="seatId" column="seat_id" />
  27. <result property="seatNo" column="seat_no" />
  28. <result property="orderState" column="order_state" />
  29. <result property="orderPrice" column="order_price" />
  30. <result property="closeCause" column="close_cause" />
  31. <result property="realSeat" column="real_seat" />
  32. <result property="ticketCode" column="ticket_code" />
  33. <result property="ticketImage" column="ticket_image" />
  34. <result property="createTime" column="create_time" />
  35. <result property="updateTime" column="update_time" />
  36. </resultMap>
  37. <sql id="selectWxOrderVo">
  38. select * from wx_order
  39. </sql>
  40. <select id="getByOutTradeNo" parameterType="string" resultType="com.miaxis.wx.domain.WxOrder">
  41. select * from wx_order where out_trade_no =#{outTradeNo}
  42. </select>
  43. <select id="selectWxOrderList" parameterType="WxOrder" resultMap="WxOrderResult">
  44. <include refid="selectWxOrderVo"/>
  45. <where>
  46. <if test="outTradeNo != null "> and out_trade_no = #{outTradeNo}</if>
  47. <if test="transactionId != null and transactionId != ''"> and transaction_id = #{transactionId}</if>
  48. <if test="tradeType != null and tradeType != ''"> and trade_type = #{tradeType}</if>
  49. <if test="tradeState != null and tradeState != ''"> and trade_state = #{tradeState}</if>
  50. <if test="tradeStateDesc != null and tradeStateDesc != ''"> and trade_state_desc = #{tradeStateDesc}</if>
  51. <if test="bankType != null and bankType != ''"> and bank_type = #{bankType}</if>
  52. <if test="attach != null and attach != ''"> and attach = #{attach}</if>
  53. <if test="successTime != null "> and success_time = #{successTime}</if>
  54. <if test="openid != null and openid != ''"> and openid = #{openid}</if>
  55. <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
  56. <if test="total != null "> and total = #{total}</if>
  57. <if test="payerTotal != null "> and payer_total = #{payerTotal}</if>
  58. <if test="currency != null and currency != ''"> and currency = #{currency}</if>
  59. <if test="payerCurrency != null and payerCurrency != ''"> and payer_currency = #{payerCurrency}</if>
  60. <if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
  61. <if test="seat != null and seat != ''"> and seat = #{seat}</if>
  62. <if test="reservedPhone != null and reservedPhone != ''"> and reserved_phone = #{reservedPhone}</if>
  63. <if test="acceptChangeSeat != null "> and accept_change_seat = #{acceptChangeSeat}</if>
  64. <if test="seatId != null and seatId != ''"> and seat_id = #{seatId}</if>
  65. <if test="seatno != null and seatno != ''"> and seat_no = #{seatNo}</if>
  66. <if test="orderState != null and orderState != ''"> and order_state = #{orderState}</if>
  67. <if test="orderPrice != null "> and order_price = #{orderPrice}</if>
  68. <if test="closeCause != null and closeCause != ''"> and close_cause = #{closeCause}</if>
  69. <if test="realSeat != null and realSeat != ''"> and real_seat = #{realSeat}</if>
  70. <if test="ticketCode != null and ticketCode != ''"> and ticket_code = #{ticketCode}</if>
  71. <if test="ticketImage != null and ticketImage != ''"> and ticket_image = #{ticketImage}</if>
  72. </where>
  73. </select>
  74. <select id="selectOrderList" resultType="com.miaxis.wx.domain.WxOrder">
  75. select * from wx_order
  76. where openid=#{openid} and trade_state ='SUCCESS'
  77. <if test="days != null and days != ''">
  78. and DATE_SUB(CURDATE(), INTERVAL #{days} DAY) &lt;= date(create_time)
  79. </if>
  80. <if test="orderStatus != null and orderStatus != ''">
  81. and order_status = #{orderStatus}
  82. </if>
  83. order by create_time desc
  84. </select>
  85. <select id="selectPcOrderList" resultType="com.miaxis.wx.domain.WxOrder">
  86. select * from wx_order
  87. where trade_state ='SUCCESS'
  88. <if test="outTradeNo != null and outTradeNo != ''">
  89. and out_trade_no = #{outTradeNo}
  90. </if>
  91. <if test="orderStatus != null and orderStatus != ''">
  92. and order_status = #{orderStatus}
  93. </if>
  94. <if test="goodsType != null and goodsType != ''">
  95. and goods_type = #{goodsType}
  96. </if>
  97. <if test="startTime != null">
  98. and DATE_FORMAT(create_time,'%Y-%m-%d')<![CDATA[ >= ]]> #{startTime}
  99. </if>
  100. <if test="endTime != null">
  101. and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ < ]]> #{endTime}
  102. </if>
  103. order by create_time desc
  104. </select>
  105. <select id="QuerySchoolOrderList" resultType="com.miaxis.wx.vo.WxSchoolOrder">
  106. select t2.nick_name,t1.id,t1.out_trade_no,t1.success_time,t1.total,t2.head_image from wx_order t1 left join user_info t2 on (t1.openid =t2.openid)
  107. where trade_state ='SUCCESS'
  108. <if test="schoolName != null and schoolName != ''">
  109. and t1.openid in (select openid from user_info where school_name = #{schoolName})
  110. </if>
  111. <if test="startTime != null">
  112. and DATE_FORMAT(t1.create_time,'%Y-%m-%d')<![CDATA[ >= ]]> #{startTime}
  113. </if>
  114. <if test="endTime != null">
  115. and DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ < ]]> #{endTime}
  116. </if>
  117. order by t1.create_time desc
  118. </select>
  119. </mapper>