OrderSellerMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.caimei365.order.mapper.OrderSellerMapper">
  4. <update id="updateClubLastCheckOrderDate">
  5. UPDATE club SET lastCheckOrderDate = #{date} WHERE clubID = #{clubId}
  6. </update>
  7. <select id="getClubUserIds" resultType="java.lang.Integer">
  8. SELECT userID FROM club WHERE spID = #{serviceProviderId}
  9. </select>
  10. <select id="getOrderList" resultType="com.caimei365.order.model.vo.OrderVo">
  11. SELECT
  12. orderSeen,
  13. orderID AS orderId,
  14. shopOrderIds,
  15. orderSource,
  16. orderNo,
  17. userID AS userId,
  18. clubID AS clubId,
  19. buyUserID AS buyUserId,
  20. orderTime,
  21. updateDate,
  22. delFlag,
  23. userBeans,
  24. orderType,
  25. orderSubmitType,
  26. confirmFlag,
  27. onlinePayFlag,
  28. splitFlag,
  29. payFlag,
  30. receiptStatus,
  31. payStatus,
  32. zeroCostFlag,
  33. sendOutStatus,
  34. refundType,
  35. affirmPaymentFlag,
  36. productCount,
  37. presentCount,
  38. promotionalGiftsCount,
  39. hasActProduct,
  40. promotionFullReduction,
  41. secondHandOrderFlag,
  42. invoiceFlag,
  43. freePostFlag AS postageFlag,
  44. freight AS postage,
  45. productTotalFee,
  46. orderTotalFee,
  47. payTotalFee,
  48. payableAmount,
  49. balancePayFee,
  50. discountFee,
  51. couponAmount,
  52. status,
  53. confirmTime,
  54. payTime,
  55. rebateFlag,
  56. clauseID AS clauseId,
  57. clauseName
  58. FROM cm_order
  59. WHERE delFlag = 0 AND userID IN
  60. <foreach item="userId" index="index" collection="userIds" open="(" separator="," close=")">
  61. #{userId}
  62. </foreach>
  63. <if test="listType == 1 ">
  64. AND status = '0'
  65. </if>
  66. <if test="listType == 2 ">
  67. AND status IN(11,12,13,21,22,23)
  68. </if>
  69. <if test="listType == 3 ">
  70. AND status IN(11,12,21,22,31,32)
  71. </if>
  72. <if test="listType == 4 ">
  73. AND status IN(12,13,22,23,32,33)
  74. </if>
  75. <if test="listType == 5 ">
  76. AND refundType IN(1,2)
  77. </if>
  78. <if test="orderSubmitType == 1">
  79. AND orderSubmitType IN (0,1,2)
  80. </if>
  81. <if test="orderSubmitType == 2">
  82. AND orderSubmitType IN (3,4)
  83. </if>
  84. <if test="orderNo != null and orderNo != '' ">
  85. AND orderNo = #{orderNo}
  86. </if>
  87. ORDER BY orderTime DESC
  88. </select>
  89. <select id="getSpIdByClubId" resultType="java.lang.Integer">
  90. SELECT spID FROM club WHERE clubID = #{clubId}
  91. </select>
  92. <select id="getOrderListClub" resultType="com.caimei365.order.model.vo.OrderVo">
  93. SELECT
  94. orderID AS orderId,
  95. shopOrderIds,
  96. orderSource,
  97. orderNo,
  98. userID AS userId,
  99. clubID AS clubId,
  100. buyUserID AS buyUserId,
  101. orderTime,
  102. updateDate,
  103. delFlag,
  104. userBeans,
  105. orderType,
  106. orderSubmitType,
  107. confirmFlag,
  108. onlinePayFlag,
  109. splitFlag,
  110. payFlag,
  111. receiptStatus,
  112. payStatus,
  113. zeroCostFlag,
  114. sendOutStatus,
  115. refundType,
  116. affirmPaymentFlag,
  117. productCount,
  118. presentCount,
  119. promotionalGiftsCount,
  120. hasActProduct,
  121. promotionFullReduction,
  122. secondHandOrderFlag,
  123. invoiceFlag,
  124. freePostFlag AS postageFlag,
  125. freight AS postage,
  126. productTotalFee,
  127. orderTotalFee,
  128. payTotalFee,
  129. payableAmount,
  130. balancePayFee,
  131. discountFee,
  132. couponAmount,
  133. status,
  134. confirmTime,
  135. payTime,
  136. rebateFlag,
  137. clauseID AS clauseId,
  138. clauseName
  139. FROM cm_order
  140. WHERE delFlag = 0 AND clubID = #{clubId}
  141. <if test="listType == 1 ">
  142. AND status = '0'
  143. </if>
  144. <if test="listType == 2 ">
  145. AND status IN(11,12,13,21,22,23)
  146. </if>
  147. <if test="listType == 3 ">
  148. AND status IN(11,12,21,22,31,32)
  149. </if>
  150. <if test="listType == 4 ">
  151. AND status IN(12,13,22,23,32,33)
  152. </if>
  153. <if test="listType == 5 ">
  154. AND refundType IN(1,2)
  155. </if>
  156. <if test="orderSubmitType == 1">
  157. AND orderSubmitType IN (0,1,2)
  158. </if>
  159. <if test="orderSubmitType == 2">
  160. AND orderSubmitType IN (3,4)
  161. </if>
  162. ORDER BY orderTime DESC
  163. </select>
  164. <select id="getUserIdBySpId" resultType="java.lang.Integer">
  165. SELECT userID FROM serviceprovider WHERE serviceProviderID = #{serviceProviderId}
  166. </select>
  167. <select id="getOrderListByKeyword" resultType="com.caimei365.order.model.vo.OrderVo">
  168. SELECT DISTINCT
  169. co.orderID AS orderId,
  170. co.shopOrderIds,
  171. co.orderSource,
  172. co.orderNo,
  173. co.userID AS userId,
  174. co.clubID AS clubId,
  175. co.buyUserID AS buyUserId,
  176. co.orderTime,
  177. co.updateDate,
  178. co.delFlag,
  179. co.userBeans,
  180. co.orderType,
  181. co.orderSubmitType,
  182. co.confirmFlag,
  183. co.onlinePayFlag,
  184. co.splitFlag,
  185. co.payFlag,
  186. co.receiptStatus,
  187. co.payStatus,
  188. co.zeroCostFlag,
  189. co.sendOutStatus,
  190. co.refundType,
  191. co.affirmPaymentFlag,
  192. co.productCount,
  193. co.presentCount,
  194. co.promotionalGiftsCount,
  195. co.hasActProduct,
  196. co.promotionFullReduction,
  197. co.secondHandOrderFlag,
  198. co.invoiceFlag,
  199. co.freePostFlag AS postageFlag,
  200. co.freight AS postage,
  201. co.productTotalFee,
  202. co.orderTotalFee,
  203. co.payTotalFee,
  204. co.payableAmount,
  205. co.balancePayFee,
  206. co.discountFee,
  207. co.couponAmount,
  208. co.status,
  209. co.confirmTime,
  210. co.payTime,
  211. co.rebateFlag,
  212. co.clauseID AS clauseId,
  213. co.clauseName
  214. FROM cm_order co
  215. LEFT JOIN cm_order_product cop ON co.orderID = cop.orderID
  216. WHERE co.delFlag = 0 AND co.userID IN
  217. <foreach item="userId" index="index" collection="userIds" open="(" separator="," close=")">
  218. #{userId}
  219. </foreach>
  220. AND cop.name LIKE CONCAT('%',#{searchWord},'%')
  221. GROUP BY co.orderID, co.orderTime
  222. ORDER BY co.orderTime DESC
  223. </select>
  224. <select id="getClubIdsBySellerId" resultType="java.lang.Integer">
  225. select userID from club where spID = #{serviceProviderId}
  226. </select>
  227. <select id="getSellerOrderCount" resultType="java.lang.Integer">
  228. SELECT COUNT(*) FROM cm_order
  229. WHERE delFlag = 0 AND userID IN
  230. <foreach item="userId" index="index" collection="userIds" open="(" separator="," close=")">
  231. #{userId}
  232. </foreach>
  233. <if test="orderState == 1 ">
  234. AND status = '0'
  235. </if>
  236. <if test="orderState == 2 ">
  237. AND status IN(11,12,13,21,22,23)
  238. </if>
  239. <if test="orderState == 3 ">
  240. AND status IN(11,12,21,22,31,32)
  241. </if>
  242. <if test="orderState == 4 ">
  243. AND status IN(12,13,22,23,32,33)
  244. </if>
  245. <if test="orderState == 5 ">
  246. AND refundType IN(1,2)
  247. </if>
  248. </select>
  249. <select id="getLastCheckOrderDate" resultType="java.util.Date">
  250. SELECT lastCheckOrderDate FROM club WHERE userID = #{userId} LIMIT 1
  251. </select>
  252. <select id="getUncheckedOrderCount" resultType="java.lang.Integer">
  253. SELECT COUNT(*) FROM cm_order
  254. WHERE userID = #{userId}
  255. AND orderSubmitType IN (0, 1, 2)
  256. <if test="lastCheckOrderDate != null">
  257. AND orderTime > #{lastCheckOrderDate}
  258. </if>
  259. </select>
  260. </mapper>