Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

219 wiersze
9.7 KiB

  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.iformall.mapper.WxPayOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxPayOrder">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="sub_tenant_id" jdbcType="VARCHAR" property="subTenantId" />
  8. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  9. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  10. <result column="order_id" jdbcType="BIGINT" property="orderId"/>
  11. <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/>
  12. <result column="b_user_id" jdbcType="BIGINT" property="bUserId"/>
  13. <result column="auth_code" jdbcType="VARCHAR" property="authCode"/>
  14. <result column="ip" jdbcType="VARCHAR" property="ip"/>
  15. <result column="pay_amount" jdbcType="INTEGER" property="payAmount"/>
  16. <result column="pay_time_start" jdbcType="TIMESTAMP" property="payTimeStart"/>
  17. <result column="pay_time_end" jdbcType="TIMESTAMP" property="payTimeEnd"/>
  18. <result column="prepay_id" jdbcType="VARCHAR" property="prepayId"/>
  19. <result column="transaction_id" jdbcType="VARCHAR" property="transactionId"/>
  20. <result column="pay_vendor" jdbcType="INTEGER" property="payVendor"/>
  21. <result column="pay_order_no" jdbcType="VARCHAR" property="payOrderNo"/>
  22. <result column="pay_order_status" jdbcType="INTEGER" property="payOrderStatus"/>
  23. <result column="share" jdbcType="INTEGER" property="share"/>
  24. <result column="share_amount" jdbcType="INTEGER" property="shareAmount"/>
  25. <result column="rate_amount" jdbcType="INTEGER" property="rateAmount"/>
  26. <result column="fail_reason" jdbcType="VARCHAR" property="failReason"/>
  27. <result column="pos_pay_order_id" jdbcType="BIGINT" property="posPayOrderId"/>
  28. <result column="pos_pay_order_time" jdbcType="BIGINT" property="posPayOrderTime"/>
  29. <result column="pos_payment_type" jdbcType="INTEGER" property="posPaymentType"/>
  30. <result column="pos_pay_order_no" jdbcType="INTEGER" property="posPayOrderNo"/>
  31. <result column="pos_pay_des" jdbcType="INTEGER" property="posPayDes"/>
  32. </resultMap>
  33. <sql id="allColumns">
  34. `id`,`tenant_id`,`sub_tenant_id`,`create_time`,`update_time`,`order_id`,`c_user_id`,`b_user_id`,
  35. `auth_code`,`ip`,`pay_amount`,`pay_time_start`,`pay_time_end`,
  36. `prepay_id`,`transaction_id`,`pay_vendor`,`pay_order_no`,
  37. `pay_order_status`,`share`,`share_amount`,`rate_amount`,`fail_reason`,
  38. `pos_pay_order_id`,`pos_pay_order_time`,`pos_payment_type`,`pos_pay_order_no`,`pos_pay_des`
  39. </sql>
  40. <sql id="dynamicWhereConditions">
  41. where 1 = 1
  42. <if test=" null != id ">
  43. and `id` = #{id}
  44. </if>
  45. <if test=" null != tenantId ">
  46. and `tenant_id` = #{tenantId}
  47. </if>
  48. <if test=" null != subTenantId ">
  49. and `sub_tenant_id` = #{subTenantId}
  50. </if>
  51. <if test=" null != createTime ">
  52. and `create_time` = #{createTime}
  53. </if>
  54. <if test=" null != updateTime ">
  55. and `update_time` = #{updateTime}
  56. </if>
  57. <if test=" null != orderId ">
  58. and `order_id` = #{orderId}
  59. </if>
  60. <if test=" null != cUserId ">
  61. and `c_user_id` = #{cUserId}
  62. </if>
  63. <if test=" null != bUserId ">
  64. and `b_user_id` = #{bUserId}
  65. </if>
  66. <if test=" null != authCode ">
  67. and `auth_code` = #{authCode}
  68. </if>
  69. <if test=" null != ip ">
  70. and `ip` like concat('%', #{ip},'%')
  71. </if>
  72. <if test=" null != payAmount ">
  73. and `pay_amount` = #{payAmount}
  74. </if>
  75. <if test=" null != payTimeStart ">
  76. and `pay_time_start` = #{payTimeStart}
  77. </if>
  78. <if test=" null != payTimeEnd ">
  79. and `pay_time_end` = #{payTimeEnd}
  80. </if>
  81. <if test=" null != prepayId ">
  82. and `prepay_id` like concat('%', #{prepayId},'%')
  83. </if>
  84. <if test=" null != transactionId ">
  85. and `transaction_id` like concat('%', #{transactionId},'%')
  86. </if>
  87. <if test=" null != payVendor ">
  88. and `pay_vendor` = #{payVendor}
  89. </if>
  90. <if test=" null != payOrderNo ">
  91. and `pay_order_no` like concat('%', #{payOrderNo},'%')
  92. </if>
  93. <if test=" null != payOrderStatus ">
  94. and `pay_order_status` = #{payOrderStatus}
  95. </if>
  96. <if test=" null != share ">
  97. and `share` = #{share}
  98. </if>
  99. <if test=" null != shareAmount ">
  100. and `share_amount` = #{shareAmount}
  101. </if>
  102. <if test=" null != failReason ">
  103. and `fail_reason` like concat('%', #{failReason},'%')
  104. </if>
  105. <if test=" null != posPayOrderId ">
  106. and `pos_pay_order_id` = #{posPayOrderId}
  107. </if>
  108. <if test=" null != posPayOrderTime ">
  109. and `pos_pay_order_time` = #{posPayOrderTime}
  110. </if>
  111. <if test=" null != posPaymentType ">
  112. and `pos_payment_type` = #{posPaymentType}
  113. </if>
  114. <if test=" null != posPayOrderNo ">
  115. and `pos_pay_order_no` = #{posPayOrderNo}
  116. </if>
  117. <if test=" null != ids ">
  118. and id in
  119. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  120. #{idItem}
  121. </foreach>
  122. </if>
  123. <if test=" null != sortColumns">order by ${sortColumns}</if>
  124. </sql>
  125. <select id="findList" parameterType="com.iformall.domain.po.WxPayOrder" resultMap="BaseResultMap">
  126. select
  127. <include refid="allColumns"/>
  128. from wx_pay_order
  129. <include refid="dynamicWhereConditions"/>
  130. </select>
  131. <select id="findListForUnPs" parameterType="com.iformall.domain.po.WxPayOrder" resultMap="BaseResultMap">
  132. select
  133. <include refid="allColumns"/>
  134. from wx_pay_order
  135. where 1=1
  136. <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
  137. <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if>
  138. and id not in (
  139. select order_id from wx_profit_sharing_order where create_time>'2019-10-15'
  140. )
  141. and `create_time` > '2019-10-15'
  142. and share = 1 and pay_order_status = 1 and `prepay_id` is null
  143. and tenant_id in (select tenant_id from wx_pay_account where share =1) and tenant_id != '789' and tenant_id != '1000' ;
  144. </select>
  145. <resultMap id="VBaseResultMap" type="com.iformall.domain.vo.WxPayOrderVo">
  146. <id column="id" jdbcType="BIGINT" property="id"/>
  147. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  148. <result column="sub_tenant_id" jdbcType="VARCHAR" property="subTenantId" />
  149. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  150. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  151. <result column="order_id" jdbcType="BIGINT" property="orderId"/>
  152. <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/>
  153. <result column="b_user_id" jdbcType="BIGINT" property="bUserId"/>
  154. <result column="auth_code" jdbcType="VARCHAR" property="authCode"/>
  155. <result column="ip" jdbcType="VARCHAR" property="ip"/>
  156. <result column="pay_amount" jdbcType="INTEGER" property="payAmount"/>
  157. <result column="pay_time_start" jdbcType="TIMESTAMP" property="payTimeStart"/>
  158. <result column="pay_time_end" jdbcType="TIMESTAMP" property="payTimeEnd"/>
  159. <result column="prepay_id" jdbcType="VARCHAR" property="prepayId"/>
  160. <result column="transaction_id" jdbcType="VARCHAR" property="transactionId"/>
  161. <result column="pay_vendor" jdbcType="INTEGER" property="payVendor"/>
  162. <result column="pay_order_no" jdbcType="VARCHAR" property="payOrderNo"/>
  163. <result column="pay_order_status" jdbcType="INTEGER" property="payOrderStatus"/>
  164. <result column="share" jdbcType="INTEGER" property="share"/>
  165. <result column="share_amount" jdbcType="INTEGER" property="shareAmount"/>
  166. <result column="rate_amount" jdbcType="INTEGER" property="rateAmount"/>
  167. <result column="fail_reason" jdbcType="VARCHAR" property="failReason"/>
  168. <result column="open_id" jdbcType="VARCHAR" property="openId"/>
  169. <result column="app_id" jdbcType="VARCHAR" property="appId"/>
  170. <result column="pay_id" jdbcType="BIGINT" property="payId"/>
  171. </resultMap>
  172. <sql id="allVColumns">
  173. p.`id`,p.`tenant_id`,p.`sub_tenant_id`,p.`create_time`,p.`update_time`,p.`order_id`,p.`c_user_id`,p.`b_user_id`,
  174. p.`auth_code`,p.`ip`,p.`pay_amount`,p.`pay_time_start`,p.`pay_time_end`,
  175. p.`prepay_id`,p.`transaction_id`,p.`pay_vendor`,p.`pay_order_no`,
  176. p.`pay_order_status`,p.`share`,p.`share_amount`,p.`rate_amount`,p.`fail_reason`,
  177. u.`open_id`,
  178. a.`app_id`, a.`pay_id`
  179. </sql>
  180. <select id="findListOfPaidOrderByDate" parameterType="map" resultMap="VBaseResultMap">
  181. select
  182. <include refid="allVColumns"/>
  183. from wx_pay_order p
  184. left join wx_c_user u on p.`c_user_id` = u.`id`
  185. left join wx_appinfo a on a.`tenant_id` = p.`tenant_id` and a.`type` = 2
  186. where p.`pay_order_status` = '1' and p.`pay_vendor` = 0 and u.`union_id` is null
  187. <if test="startDate != null">
  188. AND unix_timestamp(p.`pay_time_end`) &gt; unix_timestamp(#{startDate,jdbcType=TIMESTAMP})
  189. </if>
  190. </select>
  191. </mapper>