PayMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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.caimei.module.pay.dao.PayDao">
  6. <select id="findOrder" resultType="com.caimei.module.base.entity.vo.OrderVo">
  7. SELECT
  8. *
  9. FROM
  10. cm_order
  11. WHERE
  12. orderID = #{orderID}
  13. AND delFlag = '0'
  14. </select>
  15. <select id="getDiscernReceipt" resultType="com.caimei.module.base.entity.vo.DiscernReceiptVo">
  16. SELECT
  17. cdr.*,
  18. cror.associateAmount
  19. FROM
  20. cm_receipt_order_relation cror
  21. LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
  22. WHERE
  23. (
  24. cror.orderID = #{orderID}
  25. AND cror.relationType = '2'
  26. OR
  27. cror.orderID = #{shopOrderIDs}
  28. AND cror.relationType = '1'
  29. )
  30. AND cror.delFlag = '0'
  31. AND cdr.delFlag = '0'
  32. AND cdr.payType != '16'
  33. ORDER BY
  34. cdr.receiptDate DESC
  35. </select>
  36. <update id="updateSelective" parameterType="com.caimei.module.base.entity.po.CmOrder">
  37. update cm_order
  38. <set>
  39. <if test="orderNo != null">
  40. orderNo = #{orderNo,jdbcType=VARCHAR},
  41. </if>
  42. <if test="organizeID != null">
  43. organizeID = #{organizeID,jdbcType=INTEGER},
  44. </if>
  45. <if test="userID != null">
  46. userID = #{userID,jdbcType=BIGINT},
  47. </if>
  48. <if test="buyUserID != null">
  49. buyUserID = #{buyUserID,jdbcType=INTEGER},
  50. </if>
  51. <if test="shopOrderIDs != null">
  52. shopOrderIDs = #{shopOrderIDs,jdbcType=VARCHAR},
  53. </if>
  54. <if test="orderSubmitType != null">
  55. orderSubmitType = #{orderSubmitType,jdbcType=INTEGER},
  56. </if>
  57. <if test="orderType != null">
  58. orderType = #{orderType,jdbcType=INTEGER},
  59. </if>
  60. <if test="hasActProduct != null">
  61. hasActProduct = #{hasActProduct,jdbcType=CHAR},
  62. </if>
  63. <if test="autoCloseTimeMills != null">
  64. autoCloseTimeMills = #{autoCloseTimeMills,jdbcType=DECIMAL},
  65. </if>
  66. <if test="status != null">
  67. `status` = #{status,jdbcType=CHAR},
  68. </if>
  69. <if test="receiptStatus != null">
  70. receiptStatus = #{receiptStatus,jdbcType=CHAR},
  71. </if>
  72. <if test="payStatus != null">
  73. payStatus = #{payStatus,jdbcType=CHAR},
  74. </if>
  75. <if test="sendOutStatus != null">
  76. sendOutStatus = #{sendOutStatus,jdbcType=CHAR},
  77. </if>
  78. <if test="refundType != null">
  79. refundType = #{refundType,jdbcType=CHAR},
  80. </if>
  81. <if test="payFlag != null">
  82. payFlag = #{payFlag,jdbcType=CHAR},
  83. </if>
  84. <if test="onlinePayFlag != null">
  85. onlinePayFlag = #{onlinePayFlag,jdbcType=CHAR},
  86. </if>
  87. <if test="productTotalFee != null">
  88. productTotalFee = #{productTotalFee,jdbcType=DECIMAL},
  89. </if>
  90. <if test="orderTotalFee != null">
  91. orderTotalFee = #{orderTotalFee,jdbcType=DECIMAL},
  92. </if>
  93. <if test="payTotalFee != null">
  94. payTotalFee = #{payTotalFee,jdbcType=DECIMAL},
  95. </if>
  96. <if test="payableAmount != null">
  97. payableAmount = #{payableAmount,jdbcType=DECIMAL},
  98. </if>
  99. <if test="balancePayFee != null">
  100. balancePayFee = #{balancePayFee,jdbcType=DECIMAL},
  101. </if>
  102. <if test="preferential != null">
  103. preferential = #{preferential,jdbcType=DECIMAL},
  104. </if>
  105. <if test="discountFee != null">
  106. discountFee = #{discountFee,jdbcType=DECIMAL},
  107. </if>
  108. <if test="spID != null">
  109. spID = #{spID,jdbcType=BIGINT},
  110. </if>
  111. <if test="mainSpID != null">
  112. mainSpID = #{mainSpID,jdbcType=BIGINT},
  113. </if>
  114. <if test="note != null">
  115. note = #{note,jdbcType=VARCHAR},
  116. </if>
  117. <if test="clubID != null">
  118. clubID = #{clubID,jdbcType=BIGINT},
  119. </if>
  120. <if test="clubScanTime != null">
  121. clubScanTime = #{clubScanTime,jdbcType=VARCHAR},
  122. </if>
  123. <if test="payWay != null">
  124. payWay = #{payWay,jdbcType=VARCHAR},
  125. </if>
  126. <if test="orderSource != null">
  127. orderSource = #{orderSource,jdbcType=CHAR},
  128. </if>
  129. <if test="closeTime != null">
  130. closeTime = #{closeTime,jdbcType=VARCHAR},
  131. </if>
  132. <if test="confirmTime != null">
  133. confirmTime = #{confirmTime,jdbcType=VARCHAR},
  134. </if>
  135. <if test="payTime != null">
  136. payTime = #{payTime,jdbcType=VARCHAR},
  137. </if>
  138. <if test="orderTime != null">
  139. orderTime = #{orderTime,jdbcType=VARCHAR},
  140. </if>
  141. <if test="productCount != null">
  142. productCount = #{productCount,jdbcType=INTEGER},
  143. </if>
  144. <if test="presentCount != null">
  145. presentCount = #{presentCount,jdbcType=INTEGER},
  146. </if>
  147. <if test="cooFreeFlag != null">
  148. cooFreeFlag = #{cooFreeFlag,jdbcType=CHAR},
  149. </if>
  150. <if test="cooFreeRate != null">
  151. cooFreeRate = #{cooFreeRate,jdbcType=INTEGER},
  152. </if>
  153. <if test="cooFreeAmount != null">
  154. cooFreeAmount = #{cooFreeAmount,jdbcType=DECIMAL},
  155. </if>
  156. <if test="invoiceFlag != null">
  157. invoiceFlag = #{invoiceFlag,jdbcType=CHAR},
  158. </if>
  159. <if test="confirmFlag != null">
  160. confirmFlag = #{confirmFlag,jdbcType=CHAR},
  161. </if>
  162. <if test="clauseID != null">
  163. clauseID = #{clauseID,jdbcType=BIGINT},
  164. </if>
  165. <if test="clauseContent != null">
  166. clauseContent = #{clauseContent,jdbcType=VARCHAR},
  167. </if>
  168. <if test="clauseName != null">
  169. clauseName = #{clauseName,jdbcType=VARCHAR},
  170. </if>
  171. <if test="updateDate != null">
  172. updateDate = #{updateDate,jdbcType=VARCHAR},
  173. </if>
  174. <if test="freePostFlag != null">
  175. freePostFlag = #{freePostFlag,jdbcType=CHAR},
  176. </if>
  177. <if test="freight != null">
  178. freight = #{freight,jdbcType=DECIMAL},
  179. </if>
  180. <if test="delFlag != null">
  181. delFlag = #{delFlag,jdbcType=CHAR},
  182. </if>
  183. <if test="freePostageTicketID != null">
  184. freePostageTicketID = #{freePostageTicketID,jdbcType=INTEGER},
  185. </if>
  186. <if test="splitFlag != null">
  187. splitFlag = #{splitFlag,jdbcType=CHAR},
  188. </if>
  189. <if test="closeReason != null">
  190. closeReason = #{closeReason,jdbcType=VARCHAR},
  191. </if>
  192. <if test="postageOrderFlag != null">
  193. postageOrderFlag = #{postageOrderFlag,jdbcType=CHAR},
  194. </if>
  195. </set>
  196. where orderID = #{orderID,jdbcType=BIGINT}
  197. </update>
  198. <insert id="insertDiscernReceipt" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  199. parameterType="com.caimei.module.base.entity.vo.DiscernReceiptVo">
  200. INSERT INTO `cm_discern_receipt` (
  201. `payWay`, `payType`, `receiptType`,
  202. `receiptStatus`, `smsContent`, `smsMd5Code`,
  203. `orderFlag`, `receiptAmount`, `handlingFee`,
  204. `confirmType`, `confirmUserPermissionID`,
  205. `reviewUserPermissionID`, `cancelUserPermissionID`,
  206. `transactionNum`, `bankID`, `bankCode`,
  207. `kuaiQianPayTypeID`, `kuaiQianPayerID`,
  208. `rePayFlag`, `actualAmount`, `formData`,
  209. `problem`, `noOrderReason`, `reviewReason`,
  210. `cancelReason`, `receiptDate`, `confirmDate`,
  211. `reviewDate`, `cancelDate`, `updateDate`,
  212. `delFlag`
  213. )
  214. VALUES
  215. (
  216. #{payWay}, #{payType}, #{receiptType},
  217. #{receiptStatus}, #{smsContent}, #{smsMd5Code},
  218. #{orderFlag}, #{receiptAmount}, #{handlingFee},
  219. #{confirmType}, #{confirmUserPermissionID},
  220. #{reviewUserPermissionID}, #{cancelUserPermissionID},
  221. #{transactionNum}, #{bankID}, #{bankCode},
  222. #{kuaiQianPayTypeID}, #{kuaiQianPayerID},
  223. #{rePayFlag}, #{actualAmount}, #{formData},
  224. #{problem}, #{noOrderReason}, #{reviewReason},
  225. #{cancelReason}, #{receiptDate}, #{confirmDate},
  226. #{reviewDate}, #{cancelDate}, #{updateDate},
  227. #{delFlag}
  228. )
  229. </insert>
  230. <insert id="insertOrderRelation" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  231. parameterType="com.caimei.module.base.entity.vo.OrderRelationVo">
  232. INSERT INTO `cm_receipt_order_relation` (
  233. `relationType`, `receiptID`, `associateAmount`,
  234. `orderID`, `delFlag`, mbOrderId, orderRequestNo
  235. )
  236. VALUES
  237. (
  238. #{relationType}, #{receiptID}, #{associateAmount},
  239. #{orderID}, #{delFlag},#{mbOrderId},#{orderRequestNo}
  240. )
  241. </insert>
  242. <select id="findOrderPayLink" resultType="com.caimei.module.base.entity.vo.OrderPayLinkVo">
  243. SELECT
  244. *
  245. FROM
  246. cm_order_pay_link
  247. WHERE
  248. orderId = #{orderId}
  249. <if test="amount != null">
  250. AND unpaidAmount = #{amount}
  251. </if>
  252. AND delFlag = '0'
  253. AND payStatus = '0'
  254. </select>
  255. <insert id="insertOrderPayLink">
  256. insert into cm_order_pay_link
  257. <trim prefix="(" suffix=")" suffixOverrides=",">
  258. <if test="orderId != null">
  259. orderId,
  260. </if>
  261. <if test="linkLogo != null">
  262. linkLogo,
  263. </if>
  264. <if test="unpaidAmount != null">
  265. unpaidAmount,
  266. </if>
  267. <if test="generateTime != null">
  268. generateTime,
  269. </if>
  270. <if test="effectiveTime != null">
  271. effectiveTime,
  272. </if>
  273. <if test="payStatus != null">
  274. payStatus,
  275. </if>
  276. <if test="delFlag != null">
  277. delFlag,
  278. </if>
  279. </trim>
  280. <trim prefix="values (" suffix=")" suffixOverrides=",">
  281. <if test="orderId != null">
  282. #{orderId,jdbcType=BIGINT},
  283. </if>
  284. <if test="linkLogo != null">
  285. #{linkLogo,jdbcType=VARCHAR},
  286. </if>
  287. <if test="unpaidAmount != null">
  288. #{unpaidAmount,jdbcType=DECIMAL},
  289. </if>
  290. <if test="generateTime != null">
  291. #{generateTime,jdbcType=TIMESTAMP},
  292. </if>
  293. <if test="effectiveTime != null">
  294. #{effectiveTime,jdbcType=TIMESTAMP},
  295. </if>
  296. <if test="payStatus != null">
  297. #{payStatus,jdbcType=CHAR},
  298. </if>
  299. <if test="delFlag != null">
  300. #{delFlag,jdbcType=CHAR},
  301. </if>
  302. </trim>
  303. </insert>
  304. <update id="updateOrderPayLink">
  305. update cm_order_pay_link
  306. <set>
  307. <if test="orderId != null">
  308. orderId = #{orderId,jdbcType=BIGINT},
  309. </if>
  310. <if test="linkLogo != null">
  311. linkLogo = #{linkLogo,jdbcType=VARCHAR},
  312. </if>
  313. <if test="unpaidAmount != null">
  314. unpaidAmount = #{unpaidAmount,jdbcType=DECIMAL},
  315. </if>
  316. <if test="generateTime != null">
  317. generateTime = #{generateTime,jdbcType=TIMESTAMP},
  318. </if>
  319. <if test="effectiveTime != null">
  320. effectiveTime = #{effectiveTime,jdbcType=TIMESTAMP},
  321. </if>
  322. <if test="payStatus != null">
  323. payStatus = #{payStatus,jdbcType=CHAR},
  324. </if>
  325. <if test="delFlag != null">
  326. delFlag = #{delFlag,jdbcType=CHAR},
  327. </if>
  328. </set>
  329. where id = #{id,jdbcType=INTEGER}
  330. </update>
  331. <select id="getOrderPayLink" resultType="com.caimei.module.base.entity.vo.OrderPayLinkVo">
  332. SELECT
  333. *
  334. FROM
  335. cm_order_pay_link
  336. WHERE
  337. linkLogo = #{linkLogo}
  338. AND delFlag = '0'
  339. </select>
  340. <select id="fandAllOrderProduct" resultType="com.caimei.module.base.entity.vo.OrderProductVo">
  341. SELECT * FROM cm_order_product WHERE orderID = #{orderId}
  342. </select>
  343. <select id="findUser" resultType="com.caimei.module.base.entity.vo.UserVo">
  344. SELECT
  345. *
  346. FROM
  347. USER
  348. WHERE
  349. userID = #{userID}
  350. </select>
  351. </mapper>