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

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