Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

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