PayRequestMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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.mofangchuxing.aska.dao.mapper.PayRequestMapper">
  6. <resultMap id="BaseResultMap" type="com.mofangchuxing.aska.dao.domain.PayRequest">
  7. <id property="id" column="id" jdbcType="INTEGER"/>
  8. <result property="requestBody" column="request_body" jdbcType="VARCHAR"/>
  9. <result property="orderSn" column="order_sn" jdbcType="VARCHAR"/>
  10. <result property="openId" column="open_id" jdbcType="VARCHAR"/>
  11. <result property="mobile" column="mobile" jdbcType="VARCHAR"/>
  12. <result property="orderId" column="order_id" jdbcType="VARCHAR"/>
  13. <result property="amount" column="amount" jdbcType="INTEGER"/>
  14. <result property="itemId" column="item_id" jdbcType="VARCHAR"/>
  15. <result property="itemType" column="item_type" jdbcType="INTEGER"/>
  16. <result property="itemName" column="item_name" jdbcType="VARCHAR"/>
  17. <result property="itemChannel" column="item_channel" jdbcType="VARCHAR"/>
  18. <result property="retailId" column="retail_id" jdbcType="VARCHAR"/>
  19. <result property="retailName" column="retail_name" jdbcType="VARCHAR"/>
  20. <result property="useCouponId" column="use_coupon_id" jdbcType="VARCHAR"/>
  21. <result property="payChannel" column="pay_channel" jdbcType="INTEGER"/>
  22. <result property="responseBody" column="response_body" jdbcType="VARCHAR"/>
  23. <result property="payStatus" column="pay_status" jdbcType="INTEGER"/>
  24. <result property="payTime" column="pay_time" jdbcType="TIMESTAMP"/>
  25. <result property="transactionId" column="transaction_id" jdbcType="VARCHAR"/>
  26. <result property="payAmount" column="pay_amount" jdbcType="DECIMAL"/>
  27. <result property="hasRefund" column="has_refund" jdbcType="INTEGER"/>
  28. <result property="refundTotal" column="refund_total" jdbcType="DECIMAL"/>
  29. <result property="clientType" column="client_type" jdbcType="VARCHAR"/>
  30. <result property="cansplit" column="canSplit" jdbcType="INTEGER"/>
  31. <result property="callbackUrl" column="callback_url" jdbcType="VARCHAR"/>
  32. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  33. <result property="modifiedTime" column="modified_time" jdbcType="TIMESTAMP"/>
  34. </resultMap>
  35. <sql id="Base_Column_List">
  36. id,request_body,order_sn,
  37. open_id,mobile,order_id,
  38. amount,item_id,item_type,
  39. item_name,item_channel,retail_id,
  40. retail_name,use_coupon_id,pay_channel,
  41. response_body,pay_status,pay_time,
  42. transaction_id,pay_amount,has_refund,
  43. refund_total,client_type,canSplit,
  44. callback_url,create_time,modified_time
  45. </sql>
  46. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  47. select
  48. <include refid="Base_Column_List" />
  49. from pay_request
  50. where id = #{id,jdbcType=INTEGER}
  51. </select>
  52. <select id="selectByOrderSn" resultMap="BaseResultMap">
  53. select
  54. <include refid="Base_Column_List" />
  55. from pay_request
  56. where order_sn = #{orderSn} limit 1
  57. </select>
  58. <select id="selectPaySuccessByOrderId" resultMap="BaseResultMap">
  59. select
  60. <include refid="Base_Column_List" />
  61. from pay_request
  62. where order_id = #{orderId} and pay_status = 1 limit 1
  63. </select>
  64. <select id="selectByUser" resultMap="BaseResultMap">
  65. select order_sn, order_id, item_id, item_name, pay_status
  66. from pay_request
  67. where mobile = #{phoneNo} and item_type = #{itemType}
  68. <if test="payStatus != null">
  69. and pay_status = #{payStatus}
  70. </if>
  71. </select>
  72. <select id="selectByMobileAndOrderId" resultMap="BaseResultMap">
  73. select order_sn, order_id, item_id, item_name, pay_status
  74. from pay_request
  75. where mobile = #{phoneNo} and order_id = #{orderId}
  76. </select>
  77. <select id="getOrderList" resultType="java.util.Map">
  78. select pr.*,
  79. ifnull(asr.channelAmount,0) as channelAmount,
  80. ifnull(asr.channelRealtimeAmount,0) as channelRealtimeAmount,
  81. ifnull(asr.channelAccountAmount,0) as channelAccountAmount,
  82. ifnull(asr.retailAmount,0) as retailAmount,
  83. ifnull(asr.retailRealtimeAmount,0) as retailRealtimeAmount,
  84. ifnull(asr.retailAccountAmount,0) as retailAccountAmount
  85. from pay_request pr left join aska_splitrecord as asr on pr.id = asr.payId
  86. where 1=1
  87. <if test="retailId != null and retailId != ''">
  88. and pr.retail_id = #{retailId}
  89. </if>
  90. <if test="couponNo != null and couponNo != ''">
  91. and pr.use_coupon_id = #{couponNo}
  92. </if>
  93. <if test="orderNo != null and orderNo != ''">
  94. and pr.order_id = #{orderNo}
  95. </if>
  96. <if test="channelId != null and channelId != ''">
  97. and pr.channel_id = #{channelId}
  98. </if>
  99. <if test="startTime != null and startTime != ''">
  100. and pr.create_time > #{startTime}
  101. </if>
  102. <if test="endTime != null and endTime != ''">
  103. and pr.create_time &lt; #{endTime}
  104. </if>
  105. order by pr.id desc
  106. </select>
  107. <select id="selectByOrderId" resultMap="BaseResultMap">
  108. select
  109. <include refid="Base_Column_List" />
  110. from pay_request
  111. where order_id = #{orderId} limit 1
  112. </select>
  113. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  114. delete from pay_request
  115. where id = #{id,jdbcType=INTEGER}
  116. </delete>
  117. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.PayRequest" useGeneratedKeys="true">
  118. insert into pay_request
  119. ( id,request_body,order_sn
  120. ,open_id,mobile,order_id
  121. ,amount,item_id,item_type
  122. ,item_name,item_channel,retail_id
  123. ,retail_name,use_coupon_id,pay_channel
  124. ,response_body,pay_status,pay_time
  125. ,transaction_id,pay_amount,has_refund
  126. ,refund_total,client_type,canSplit
  127. ,callback_url,create_time,modified_time
  128. )
  129. values (#{id,jdbcType=INTEGER},#{requestBody,jdbcType=VARCHAR},#{orderSn,jdbcType=VARCHAR}
  130. ,#{openId,jdbcType=VARCHAR},#{mobile,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR}
  131. ,#{amount,jdbcType=DECIMAL},#{itemId,jdbcType=VARCHAR},#{itemType,jdbcType=INTEGER}
  132. ,#{itemName,jdbcType=VARCHAR},#{itemChannel,jdbcType=VARCHAR},#{retailId,jdbcType=VARCHAR}
  133. ,#{retailName,jdbcType=VARCHAR},#{useCouponId,jdbcType=VARCHAR},#{payChannel,jdbcType=INTEGER}
  134. ,#{responseBody,jdbcType=VARCHAR},#{payStatus,jdbcType=INTEGER},#{payTime,jdbcType=TIMESTAMP}
  135. ,#{transactionId,jdbcType=VARCHAR},#{payAmount,jdbcType=DECIMAL},#{hasRefund,jdbcType=INTEGER}
  136. ,#{refundTotal,jdbcType=DECIMAL},#{clientType,jdbcType=VARCHAR},#{cansplit,jdbcType=INTEGER}
  137. ,#{callbackUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{modifiedTime,jdbcType=TIMESTAMP}
  138. )
  139. </insert>
  140. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.PayRequest" useGeneratedKeys="true">
  141. insert into pay_request
  142. <trim prefix="(" suffix=")" suffixOverrides=",">
  143. <if test="id != null">id,</if>
  144. <if test="requestBody != null">request_body,</if>
  145. <if test="orderSn != null">order_sn,</if>
  146. <if test="openId != null">open_id,</if>
  147. <if test="mobile != null">mobile,</if>
  148. <if test="orderId != null">order_id,</if>
  149. <if test="amount != null">amount,</if>
  150. <if test="itemId != null">item_id,</if>
  151. <if test="itemType != null">item_type,</if>
  152. <if test="itemName != null">item_name,</if>
  153. <if test="itemChannel != null">item_channel,</if>
  154. <if test="channelId != null">channel_id,</if>
  155. <if test="retailId != null">retail_id,</if>
  156. <if test="retailName != null">retail_name,</if>
  157. <if test="useCouponId != null">use_coupon_id,</if>
  158. <if test="payChannel != null">pay_channel,</if>
  159. <if test="responseBody != null">response_body,</if>
  160. <if test="payStatus != null">pay_status,</if>
  161. <if test="payTime != null">pay_time,</if>
  162. <if test="transactionId != null">transaction_id,</if>
  163. <if test="payAmount != null">pay_amount,</if>
  164. <if test="hasRefund != null">has_refund,</if>
  165. <if test="refundTotal != null">refund_total,</if>
  166. <if test="clientType != null">client_type,</if>
  167. <if test="cansplit != null">canSplit,</if>
  168. <if test="callbackUrl != null">callback_url,</if>
  169. <if test="createTime != null">create_time,</if>
  170. <if test="modifiedTime != null">modified_time,</if>
  171. </trim>
  172. <trim prefix="values (" suffix=")" suffixOverrides=",">
  173. <if test="id != null">#{id,jdbcType=INTEGER},</if>
  174. <if test="requestBody != null">#{requestBody,jdbcType=VARCHAR},</if>
  175. <if test="orderSn != null">#{orderSn,jdbcType=VARCHAR},</if>
  176. <if test="openId != null">#{openId,jdbcType=VARCHAR},</if>
  177. <if test="mobile != null">#{mobile,jdbcType=VARCHAR},</if>
  178. <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
  179. <if test="amount != null">#{amount,jdbcType=DECIMAL},</if>
  180. <if test="itemId != null">#{itemId,jdbcType=VARCHAR},</if>
  181. <if test="itemType != null">#{itemType,jdbcType=INTEGER},</if>
  182. <if test="itemName != null">#{itemName,jdbcType=VARCHAR},</if>
  183. <if test="itemChannel != null">#{itemChannel,jdbcType=VARCHAR},</if>
  184. <if test="channelId != null">#{channelId,jdbcType=INTEGER},</if>
  185. <if test="retailId != null">#{retailId,jdbcType=VARCHAR},</if>
  186. <if test="retailName != null">#{retailName,jdbcType=VARCHAR},</if>
  187. <if test="useCouponId != null">#{useCouponId,jdbcType=VARCHAR},</if>
  188. <if test="payChannel != null">#{payChannel,jdbcType=INTEGER},</if>
  189. <if test="responseBody != null">#{responseBody,jdbcType=VARCHAR},</if>
  190. <if test="payStatus != null">#{payStatus,jdbcType=INTEGER},</if>
  191. <if test="payTime != null">#{payTime,jdbcType=TIMESTAMP},</if>
  192. <if test="transactionId != null">#{transactionId,jdbcType=VARCHAR},</if>
  193. <if test="payAmount != null">#{payAmount,jdbcType=DECIMAL},</if>
  194. <if test="hasRefund != null">#{hasRefund,jdbcType=INTEGER},</if>
  195. <if test="refundTotal != null">#{refundTotal,jdbcType=DECIMAL},</if>
  196. <if test="clientType != null">#{clientType,jdbcType=VARCHAR},</if>
  197. <if test="cansplit != null">#{cansplit,jdbcType=INTEGER},</if>
  198. <if test="callbackUrl != null">#{callbackUrl,jdbcType=VARCHAR},</if>
  199. <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
  200. <if test="modifiedTime != null">#{modifiedTime,jdbcType=TIMESTAMP},</if>
  201. </trim>
  202. </insert>
  203. <update id="updateByPrimaryKeySelective" parameterType="com.mofangchuxing.aska.dao.domain.PayRequest">
  204. update pay_request
  205. <set>
  206. <if test="requestBody != null">
  207. request_body = #{requestBody,jdbcType=VARCHAR},
  208. </if>
  209. <if test="orderSn != null">
  210. order_sn = #{orderSn,jdbcType=VARCHAR},
  211. </if>
  212. <if test="openId != null">
  213. open_id = #{openId,jdbcType=VARCHAR},
  214. </if>
  215. <if test="mobile != null">
  216. mobile = #{mobile,jdbcType=VARCHAR},
  217. </if>
  218. <if test="orderId != null">
  219. order_id = #{orderId,jdbcType=VARCHAR},
  220. </if>
  221. <if test="amount != null">
  222. amount = #{amount,jdbcType=DECIMAL},
  223. </if>
  224. <if test="itemId != null">
  225. item_id = #{itemId,jdbcType=VARCHAR},
  226. </if>
  227. <if test="itemType != null">
  228. item_type = #{itemType,jdbcType=INTEGER},
  229. </if>
  230. <if test="itemName != null">
  231. item_name = #{itemName,jdbcType=VARCHAR},
  232. </if>
  233. <if test="itemChannel != null">
  234. item_channel = #{itemChannel,jdbcType=VARCHAR},
  235. </if>
  236. <if test="retailId != null">
  237. retail_id = #{retailId,jdbcType=VARCHAR},
  238. </if>
  239. <if test="retailName != null">
  240. retail_name = #{retailName,jdbcType=VARCHAR},
  241. </if>
  242. <if test="useCouponId != null">
  243. use_coupon_id = #{useCouponId,jdbcType=VARCHAR},
  244. </if>
  245. <if test="payChannel != null">
  246. pay_channel = #{payChannel,jdbcType=INTEGER},
  247. </if>
  248. <if test="responseBody != null">
  249. response_body = #{responseBody,jdbcType=VARCHAR},
  250. </if>
  251. <if test="payStatus != null">
  252. pay_status = #{payStatus,jdbcType=INTEGER},
  253. </if>
  254. <if test="payTime != null">
  255. pay_time = #{payTime,jdbcType=TIMESTAMP},
  256. </if>
  257. <if test="transactionId != null">
  258. transaction_id = #{transactionId,jdbcType=VARCHAR},
  259. </if>
  260. <if test="payAmount != null">
  261. pay_amount = #{payAmount,jdbcType=DECIMAL},
  262. </if>
  263. <if test="hasRefund != null">
  264. has_refund = #{hasRefund,jdbcType=INTEGER},
  265. </if>
  266. <if test="refundTotal != null">
  267. refund_total = #{refundTotal,jdbcType=DECIMAL},
  268. </if>
  269. <if test="clientType != null">
  270. client_type = #{clientType,jdbcType=VARCHAR},
  271. </if>
  272. <if test="cansplit != null">
  273. canSplit = #{cansplit,jdbcType=INTEGER},
  274. </if>
  275. <if test="callbackUrl != null">
  276. callback_url = #{callbackUrl,jdbcType=VARCHAR},
  277. </if>
  278. <if test="createTime != null">
  279. create_time = #{createTime,jdbcType=TIMESTAMP},
  280. </if>
  281. <if test="modifiedTime != null">
  282. modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
  283. </if>
  284. </set>
  285. where id = #{id,jdbcType=INTEGER}
  286. </update>
  287. <update id="updateByPrimaryKey" parameterType="com.mofangchuxing.aska.dao.domain.PayRequest">
  288. update pay_request
  289. set
  290. request_body = #{requestBody,jdbcType=VARCHAR},
  291. order_sn = #{orderSn,jdbcType=VARCHAR},
  292. open_id = #{openId,jdbcType=VARCHAR},
  293. mobile = #{mobile,jdbcType=VARCHAR},
  294. order_id = #{orderId,jdbcType=VARCHAR},
  295. amount = #{amount,jdbcType=DECIMAL},
  296. item_id = #{itemId,jdbcType=VARCHAR},
  297. item_type = #{itemType,jdbcType=INTEGER},
  298. item_name = #{itemName,jdbcType=VARCHAR},
  299. item_channel = #{itemChannel,jdbcType=VARCHAR},
  300. retail_id = #{retailId,jdbcType=VARCHAR},
  301. retail_name = #{retailName,jdbcType=VARCHAR},
  302. use_coupon_id = #{useCouponId,jdbcType=VARCHAR},
  303. pay_channel = #{payChannel,jdbcType=INTEGER},
  304. response_body = #{responseBody,jdbcType=VARCHAR},
  305. pay_status = #{payStatus,jdbcType=INTEGER},
  306. pay_time = #{payTime,jdbcType=TIMESTAMP},
  307. transaction_id = #{transactionId,jdbcType=VARCHAR},
  308. pay_amount = #{payAmount,jdbcType=DECIMAL},
  309. has_refund = #{hasRefund,jdbcType=INTEGER},
  310. refund_total = #{refundTotal,jdbcType=DECIMAL},
  311. client_type = #{clientType,jdbcType=VARCHAR},
  312. canSplit = #{cansplit,jdbcType=INTEGER},
  313. callback_url = #{callbackUrl,jdbcType=VARCHAR},
  314. create_time = #{createTime,jdbcType=TIMESTAMP},
  315. modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
  316. where id = #{id,jdbcType=INTEGER}
  317. </update>
  318. </mapper>