PayRequestMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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="selectByOrderId" 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.*,asr.* from pay_request pr left join aska_splitrecord as asr on pr.id = asr.payId
  79. where 1=1
  80. <if test="retailId != null and retailId != ''">
  81. and pr.retail_id = #{retailId}
  82. </if>
  83. <if test="couponNo != null and couponNo != ''">
  84. and pr.use_coupon_id = #{couponNo}
  85. </if>
  86. <if test="orderNo != null and orderNo != ''">
  87. and pr.order_id = #{orderNo}
  88. </if>
  89. <if test="channelId != null and channelId != ''">
  90. and pr.channel_id = #{channelId}
  91. </if>
  92. order by pr.id desc
  93. </select>
  94. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  95. delete from pay_request
  96. where id = #{id,jdbcType=INTEGER}
  97. </delete>
  98. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.PayRequest" useGeneratedKeys="true">
  99. insert into pay_request
  100. ( id,request_body,order_sn
  101. ,open_id,mobile,order_id
  102. ,amount,item_id,item_type
  103. ,item_name,item_channel,retail_id
  104. ,retail_name,use_coupon_id,pay_channel
  105. ,response_body,pay_status,pay_time
  106. ,transaction_id,pay_amount,has_refund
  107. ,refund_total,client_type,canSplit
  108. ,callback_url,create_time,modified_time
  109. )
  110. values (#{id,jdbcType=INTEGER},#{requestBody,jdbcType=VARCHAR},#{orderSn,jdbcType=VARCHAR}
  111. ,#{openId,jdbcType=VARCHAR},#{mobile,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR}
  112. ,#{amount,jdbcType=DECIMAL},#{itemId,jdbcType=VARCHAR},#{itemType,jdbcType=INTEGER}
  113. ,#{itemName,jdbcType=VARCHAR},#{itemChannel,jdbcType=VARCHAR},#{retailId,jdbcType=VARCHAR}
  114. ,#{retailName,jdbcType=VARCHAR},#{useCouponId,jdbcType=VARCHAR},#{payChannel,jdbcType=INTEGER}
  115. ,#{responseBody,jdbcType=VARCHAR},#{payStatus,jdbcType=INTEGER},#{payTime,jdbcType=TIMESTAMP}
  116. ,#{transactionId,jdbcType=VARCHAR},#{payAmount,jdbcType=DECIMAL},#{hasRefund,jdbcType=INTEGER}
  117. ,#{refundTotal,jdbcType=DECIMAL},#{clientType,jdbcType=VARCHAR},#{cansplit,jdbcType=INTEGER}
  118. ,#{callbackUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{modifiedTime,jdbcType=TIMESTAMP}
  119. )
  120. </insert>
  121. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.PayRequest" useGeneratedKeys="true">
  122. insert into pay_request
  123. <trim prefix="(" suffix=")" suffixOverrides=",">
  124. <if test="id != null">id,</if>
  125. <if test="requestBody != null">request_body,</if>
  126. <if test="orderSn != null">order_sn,</if>
  127. <if test="openId != null">open_id,</if>
  128. <if test="mobile != null">mobile,</if>
  129. <if test="orderId != null">order_id,</if>
  130. <if test="amount != null">amount,</if>
  131. <if test="itemId != null">item_id,</if>
  132. <if test="itemType != null">item_type,</if>
  133. <if test="itemName != null">item_name,</if>
  134. <if test="itemChannel != null">item_channel,</if>
  135. <if test="channelId != null">channel_id,</if>
  136. <if test="retailId != null">retail_id,</if>
  137. <if test="retailName != null">retail_name,</if>
  138. <if test="useCouponId != null">use_coupon_id,</if>
  139. <if test="payChannel != null">pay_channel,</if>
  140. <if test="responseBody != null">response_body,</if>
  141. <if test="payStatus != null">pay_status,</if>
  142. <if test="payTime != null">pay_time,</if>
  143. <if test="transactionId != null">transaction_id,</if>
  144. <if test="payAmount != null">pay_amount,</if>
  145. <if test="hasRefund != null">has_refund,</if>
  146. <if test="refundTotal != null">refund_total,</if>
  147. <if test="clientType != null">client_type,</if>
  148. <if test="cansplit != null">canSplit,</if>
  149. <if test="callbackUrl != null">callback_url,</if>
  150. <if test="createTime != null">create_time,</if>
  151. <if test="modifiedTime != null">modified_time,</if>
  152. </trim>
  153. <trim prefix="values (" suffix=")" suffixOverrides=",">
  154. <if test="id != null">#{id,jdbcType=INTEGER},</if>
  155. <if test="requestBody != null">#{requestBody,jdbcType=VARCHAR},</if>
  156. <if test="orderSn != null">#{orderSn,jdbcType=VARCHAR},</if>
  157. <if test="openId != null">#{openId,jdbcType=VARCHAR},</if>
  158. <if test="mobile != null">#{mobile,jdbcType=VARCHAR},</if>
  159. <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
  160. <if test="amount != null">#{amount,jdbcType=DECIMAL},</if>
  161. <if test="itemId != null">#{itemId,jdbcType=VARCHAR},</if>
  162. <if test="itemType != null">#{itemType,jdbcType=INTEGER},</if>
  163. <if test="itemName != null">#{itemName,jdbcType=VARCHAR},</if>
  164. <if test="itemChannel != null">#{itemChannel,jdbcType=VARCHAR},</if>
  165. <if test="channelId != null">#{channelId,jdbcType=INTEGER},</if>
  166. <if test="retailId != null">#{retailId,jdbcType=VARCHAR},</if>
  167. <if test="retailName != null">#{retailName,jdbcType=VARCHAR},</if>
  168. <if test="useCouponId != null">#{useCouponId,jdbcType=VARCHAR},</if>
  169. <if test="payChannel != null">#{payChannel,jdbcType=INTEGER},</if>
  170. <if test="responseBody != null">#{responseBody,jdbcType=VARCHAR},</if>
  171. <if test="payStatus != null">#{payStatus,jdbcType=INTEGER},</if>
  172. <if test="payTime != null">#{payTime,jdbcType=TIMESTAMP},</if>
  173. <if test="transactionId != null">#{transactionId,jdbcType=VARCHAR},</if>
  174. <if test="payAmount != null">#{payAmount,jdbcType=DECIMAL},</if>
  175. <if test="hasRefund != null">#{hasRefund,jdbcType=INTEGER},</if>
  176. <if test="refundTotal != null">#{refundTotal,jdbcType=DECIMAL},</if>
  177. <if test="clientType != null">#{clientType,jdbcType=VARCHAR},</if>
  178. <if test="cansplit != null">#{cansplit,jdbcType=INTEGER},</if>
  179. <if test="callbackUrl != null">#{callbackUrl,jdbcType=VARCHAR},</if>
  180. <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
  181. <if test="modifiedTime != null">#{modifiedTime,jdbcType=TIMESTAMP},</if>
  182. </trim>
  183. </insert>
  184. <update id="updateByPrimaryKeySelective" parameterType="com.mofangchuxing.aska.dao.domain.PayRequest">
  185. update pay_request
  186. <set>
  187. <if test="requestBody != null">
  188. request_body = #{requestBody,jdbcType=VARCHAR},
  189. </if>
  190. <if test="orderSn != null">
  191. order_sn = #{orderSn,jdbcType=VARCHAR},
  192. </if>
  193. <if test="openId != null">
  194. open_id = #{openId,jdbcType=VARCHAR},
  195. </if>
  196. <if test="mobile != null">
  197. mobile = #{mobile,jdbcType=VARCHAR},
  198. </if>
  199. <if test="orderId != null">
  200. order_id = #{orderId,jdbcType=VARCHAR},
  201. </if>
  202. <if test="amount != null">
  203. amount = #{amount,jdbcType=DECIMAL},
  204. </if>
  205. <if test="itemId != null">
  206. item_id = #{itemId,jdbcType=VARCHAR},
  207. </if>
  208. <if test="itemType != null">
  209. item_type = #{itemType,jdbcType=INTEGER},
  210. </if>
  211. <if test="itemName != null">
  212. item_name = #{itemName,jdbcType=VARCHAR},
  213. </if>
  214. <if test="itemChannel != null">
  215. item_channel = #{itemChannel,jdbcType=VARCHAR},
  216. </if>
  217. <if test="retailId != null">
  218. retail_id = #{retailId,jdbcType=VARCHAR},
  219. </if>
  220. <if test="retailName != null">
  221. retail_name = #{retailName,jdbcType=VARCHAR},
  222. </if>
  223. <if test="useCouponId != null">
  224. use_coupon_id = #{useCouponId,jdbcType=VARCHAR},
  225. </if>
  226. <if test="payChannel != null">
  227. pay_channel = #{payChannel,jdbcType=INTEGER},
  228. </if>
  229. <if test="responseBody != null">
  230. response_body = #{responseBody,jdbcType=VARCHAR},
  231. </if>
  232. <if test="payStatus != null">
  233. pay_status = #{payStatus,jdbcType=INTEGER},
  234. </if>
  235. <if test="payTime != null">
  236. pay_time = #{payTime,jdbcType=TIMESTAMP},
  237. </if>
  238. <if test="transactionId != null">
  239. transaction_id = #{transactionId,jdbcType=VARCHAR},
  240. </if>
  241. <if test="payAmount != null">
  242. pay_amount = #{payAmount,jdbcType=DECIMAL},
  243. </if>
  244. <if test="hasRefund != null">
  245. has_refund = #{hasRefund,jdbcType=INTEGER},
  246. </if>
  247. <if test="refundTotal != null">
  248. refund_total = #{refundTotal,jdbcType=DECIMAL},
  249. </if>
  250. <if test="clientType != null">
  251. client_type = #{clientType,jdbcType=VARCHAR},
  252. </if>
  253. <if test="cansplit != null">
  254. canSplit = #{cansplit,jdbcType=INTEGER},
  255. </if>
  256. <if test="callbackUrl != null">
  257. callback_url = #{callbackUrl,jdbcType=VARCHAR},
  258. </if>
  259. <if test="createTime != null">
  260. create_time = #{createTime,jdbcType=TIMESTAMP},
  261. </if>
  262. <if test="modifiedTime != null">
  263. modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
  264. </if>
  265. </set>
  266. where id = #{id,jdbcType=INTEGER}
  267. </update>
  268. <update id="updateByPrimaryKey" parameterType="com.mofangchuxing.aska.dao.domain.PayRequest">
  269. update pay_request
  270. set
  271. request_body = #{requestBody,jdbcType=VARCHAR},
  272. order_sn = #{orderSn,jdbcType=VARCHAR},
  273. open_id = #{openId,jdbcType=VARCHAR},
  274. mobile = #{mobile,jdbcType=VARCHAR},
  275. order_id = #{orderId,jdbcType=VARCHAR},
  276. amount = #{amount,jdbcType=DECIMAL},
  277. item_id = #{itemId,jdbcType=VARCHAR},
  278. item_type = #{itemType,jdbcType=INTEGER},
  279. item_name = #{itemName,jdbcType=VARCHAR},
  280. item_channel = #{itemChannel,jdbcType=VARCHAR},
  281. retail_id = #{retailId,jdbcType=VARCHAR},
  282. retail_name = #{retailName,jdbcType=VARCHAR},
  283. use_coupon_id = #{useCouponId,jdbcType=VARCHAR},
  284. pay_channel = #{payChannel,jdbcType=INTEGER},
  285. response_body = #{responseBody,jdbcType=VARCHAR},
  286. pay_status = #{payStatus,jdbcType=INTEGER},
  287. pay_time = #{payTime,jdbcType=TIMESTAMP},
  288. transaction_id = #{transactionId,jdbcType=VARCHAR},
  289. pay_amount = #{payAmount,jdbcType=DECIMAL},
  290. has_refund = #{hasRefund,jdbcType=INTEGER},
  291. refund_total = #{refundTotal,jdbcType=DECIMAL},
  292. client_type = #{clientType,jdbcType=VARCHAR},
  293. canSplit = #{cansplit,jdbcType=INTEGER},
  294. callback_url = #{callbackUrl,jdbcType=VARCHAR},
  295. create_time = #{createTime,jdbcType=TIMESTAMP},
  296. modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
  297. where id = #{id,jdbcType=INTEGER}
  298. </update>
  299. </mapper>