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

242 строки
9.1 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.WxProfitSharingOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxProfitSharingOrder">
  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="merchant_id" jdbcType="BIGINT" property="merchantId" />
  9. <result column="order_id" jdbcType="BIGINT" property="orderId" />
  10. <result column="pay_vendor" jdbcType="INTEGER" property="payVendor"/>
  11. <result column="pay_amount" jdbcType="INTEGER" property="payAmount" />
  12. <result column="pay_time_end" jdbcType="TIMESTAMP" property="payTimeEnd" />
  13. <result column="pay_time_start" jdbcType="TIMESTAMP" property="payTimeStart" />
  14. <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" />
  15. <result column="sharing_order_no" jdbcType="VARCHAR" property="sharingOrderNo" />
  16. <result column="type" jdbcType="INTEGER" property="type" />
  17. <result column="receivers" jdbcType="VARCHAR" property="receivers" />
  18. <result column="error_msg" jdbcType="VARCHAR" property="errorMsg" />
  19. <result column="sharing_status" jdbcType="INTEGER" property="sharingStatus" />
  20. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  21. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  22. </resultMap>
  23. <sql id="allColumns">
  24. `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`order_id`,`pay_vendor`,`pay_amount`,`pay_time_end`,`pay_time_start`,`transaction_id`,`sharing_order_no`,`type`,`receivers`,`error_msg`,`sharing_status`,`update_time`,`create_time`
  25. </sql>
  26. <sql id="dynamicWhereConditions">
  27. where 1 = 1
  28. <if test=" null != id ">
  29. and `id` = #{id}
  30. </if>
  31. <if test=" null != tenantId and '' != tenantId">
  32. and `tenant_id` = #{tenantId}
  33. </if>
  34. <if test=" null != parentTenantId and '' != parentTenantId">
  35. and `parent_tenant_id` = #{parentTenantId}
  36. </if>
  37. <if test=" null != merchantId ">
  38. and `merchant_id` = #{merchantId}
  39. </if>
  40. <if test=" null != orderId ">
  41. and `order_id` = #{orderId}
  42. </if>
  43. <if test=" null != payVendor ">
  44. and `pay_vendor` = #{payVendor}
  45. </if>
  46. <if test=" null != type ">
  47. and `type` = #{type}
  48. </if>
  49. <if test=" null != payAmount ">
  50. and `pay_amount` = #{payAmount}
  51. </if>
  52. <if test=" null != payTimeEnd ">
  53. and `pay_time_end` = #{payTimeEnd}
  54. </if>
  55. <if test=" null != payTimeStart ">
  56. and `pay_time_start` = #{payTimeStart}
  57. </if>
  58. <if test=" null != transactionId ">
  59. and `transaction_id` = #{transactionId}
  60. </if>
  61. <if test=" null != sharingOrderNo ">
  62. and `sharing_order_id` = #{sharingOrderId}
  63. </if>
  64. <if test=" null != errorMsg ">
  65. and `error_msg` like concat('%', #{errorMsg},'%')
  66. </if>
  67. <if test=" null != sharingStatus ">
  68. and `sharing_status` like concat('%', #{sharingStatus},'%')
  69. </if>
  70. <if test=" null != updateTime ">
  71. and `update_time` = #{updateTime}
  72. </if>
  73. <if test=" null != createTime ">
  74. and `create_time` = #{createTime}
  75. </if>
  76. <if test=" null != ids ">
  77. and id in
  78. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  79. #{idItem}
  80. </foreach>
  81. </if>
  82. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  83. </sql>
  84. <select id="findList" parameterType="com.iformall.domain.po.WxProfitSharingOrder" resultMap="BaseResultMap">
  85. select
  86. <include refid="allColumns"/>
  87. from wx_profit_sharing_order
  88. <include refid="dynamicWhereConditions" />
  89. </select>
  90. <resultMap id="orderMap" type="com.iformall.domain.vo.WxProfitSharingOrderVo">
  91. <id column="id" jdbcType="BIGINT" property="id" />
  92. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  93. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  94. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  95. <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />
  96. <result column="order_id" jdbcType="BIGINT" property="orderId" />
  97. <result column="pay_amount" jdbcType="INTEGER" property="payAmount" />
  98. <result column="pay_time_end" jdbcType="TIMESTAMP" property="payTimeEnd" />
  99. <result column="pay_time_start" jdbcType="TIMESTAMP" property="payTimeStart" />
  100. <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" />
  101. <result column="sharing_order_no" jdbcType="VARCHAR" property="sharingOrderNo" />
  102. <result column="type" jdbcType="INTEGER" property="type" />
  103. <result column="receivers" jdbcType="VARCHAR" property="receivers" />
  104. <result column="error_msg" jdbcType="VARCHAR" property="errorMsg" />
  105. <result column="sharing_status" jdbcType="INTEGER" property="sharingStatus" />
  106. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  107. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  108. </resultMap>
  109. <select id="findOrderList" parameterType="com.iformall.domain.vo.WxProfitSharingOrderQueryVo" resultMap="orderMap">
  110. select pso.*,m.`name` merchant_name from wx_profit_sharing_order pso
  111. left join wx_merchant m on pso.merchant_id=m.id
  112. <where>
  113. <if test=" null != tenantId and '' != tenantId">
  114. and pso.`tenant_id` = #{tenantId}
  115. </if>
  116. <if test=" null != parentTenantId and '' != parentTenantId">
  117. and pso.`parent_tenant_id` = #{parentTenantId}
  118. </if>
  119. <if test="id!=null">
  120. and pso.id =#{id}
  121. </if>
  122. <if test="merchantName!=null and ''!=merchantName">
  123. and m.`name` like concat('%',#{merchantName},'%')
  124. </if>
  125. <if test="startdate!=null and enddate!=null">
  126. and pso.create_time between #{startdate} and #{enddate}
  127. </if>
  128. <if test="sharingStatus!=null">
  129. and pso.sharing_status = #{sharingStatus}
  130. </if>
  131. <if test="type!=null">
  132. and pso.type = #{type}
  133. </if>
  134. </where>
  135. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  136. <if test=" null == sortColumns">order by pso.id desc</if>
  137. <if test=" null != begin ">
  138. limit #{begin}, #{limit}
  139. </if>
  140. </select>
  141. <select id="queryOrderForMerchantCount" resultType="Long" parameterType="hashmap">
  142. select count(*) merchantCount from (
  143. select distinct merchant_id from wx_profit_sharing_order
  144. <where>
  145. <if test=" null != tenantId and '' != tenantId">
  146. and `tenant_id` = #{tenantId}
  147. </if>
  148. <if test=" null != parentTenantId and '' != parentTenantId">
  149. and `parent_tenant_id` = #{parentTenantId}
  150. </if>
  151. <if test="startdate!=null and enddate!=null">
  152. and create_time between #{startdate} and #{enddate}
  153. </if>
  154. </where>
  155. ) o
  156. </select>
  157. <select id="queryOrderForSum" resultType="Long" parameterType="hashmap">
  158. select ifnull(sum(pay_amount),0) payment from wx_profit_sharing_order
  159. <where>
  160. <if test=" null != tenantId and '' != tenantId">
  161. and `tenant_id` = #{tenantId}
  162. </if>
  163. <if test=" null != parentTenantId and '' != parentTenantId">
  164. and `parent_tenant_id` = #{parentTenantId}
  165. </if>
  166. <if test="startdate!=null and enddate!=null">
  167. and create_time between #{startdate} and #{enddate}
  168. </if>
  169. </where>
  170. </select>
  171. <resultMap id="orderDetailsMap" type="com.iformall.domain.vo.WxProfitSharingOrderDetailsVo">
  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="pay_amount" jdbcType="INTEGER" property="payAmount" />
  176. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  177. <result column="sharing_status" jdbcType="INTEGER" property="sharingStatus" />
  178. <result column="finish_time" jdbcType="VARCHAR" property="finishTime" />
  179. <result column="failed_reason" jdbcType="VARCHAR" property="failedReason" />
  180. <result column="description" jdbcType="VARCHAR" property="description" />
  181. <result column="receiver_type" jdbcType="INTEGER" property="receiverType" />
  182. <result column="receiver_account" jdbcType="VARCHAR" property="receiverAccount" />
  183. <result column="receiver_comments" jdbcType="VARCHAR" property="receiverComments" />
  184. <result column="sharing_type" jdbcType="INTEGER" property="sharingType" />
  185. <result column="status" jdbcType="VARCHAR" property="status" />
  186. </resultMap>
  187. <select id="findOrderDetails" parameterType="java.util.HashMap" resultMap="orderDetailsMap">
  188. select psr.id,psr.tenant_id,psr.parent_tenant_id,psr.pay_amount,psr.create_time,sharing_status,finish_time,failed_reason,description,
  189. psre.receiver_type,psre.receiver_account,psre.receiver_comments,psre.sharing_type,psre.`status`
  190. from wx_profit_sharing_result psr left join wx_profit_sharing_receiver psre on psr.sharing_receiver_id=psre.id
  191. where psr.sharing_order_id=#{id} and psr.tenant_id=#{tenantId} and psr.sharing_receiver_id!=0
  192. </select>
  193. </mapper>