您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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