Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

189 righe
8.4 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.iformall.mapper.WxOfflineActivityGrantSettlementMapper">
  6. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxOfflineActivityGrantSettlement">
  7. <id property="id" column="id" jdbcType="BIGINT"/>
  8. <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
  9. <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/>
  10. <result property="recordId" column="record_id" jdbcType="BIGINT"/>
  11. <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
  12. <result property="orderMoney" column="order_money" jdbcType="DECIMAL"/>
  13. <result property="merchantId" column="merchant_id" jdbcType="BIGINT"/>
  14. <result property="activityId" column="activity_id" jdbcType="BIGINT"/>
  15. <result property="activityItemId" column="activity_item_id" jdbcType="BIGINT"/>
  16. <result property="awardItamId" column="award_itam_id" jdbcType="BIGINT"/>
  17. <result property="grantId" column="grant_id" jdbcType="BIGINT"/>
  18. <result property="grantPrice" column="grant_price" jdbcType="DECIMAL"/>
  19. <result property="mallShareRate" column="mall_share_rate" jdbcType="DECIMAL"/>
  20. <result property="merchantShareRate" column="merchant_share_rate" jdbcType="DECIMAL"/>
  21. <result property="orderRatio" column="order_ratio" jdbcType="DECIMAL"/>
  22. <result property="realGrantPrice" column="real_grant_price" jdbcType="DECIMAL"/>
  23. <result property="realMallSharePrice" column="real_mall_share_price" jdbcType="DECIMAL"/>
  24. <result property="realMerchantSharePrice" column="real_merchant_share_price" jdbcType="DECIMAL"/>
  25. <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
  26. <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
  27. </resultMap>
  28. <sql id="allColumns">
  29. id,tenant_id,parent_tenant_id,
  30. record_id,order_no,order_money,
  31. merchant_id,activity_id,activity_item_id,
  32. award_itam_id,grant_id,grant_price,
  33. mall_share_rate,merchant_share_rate,order_ratio,
  34. real_grant_price,real_mall_share_price,real_merchant_share_price,
  35. create_date,update_date
  36. </sql>
  37. <sql id="dynamicWhereConditions">
  38. where 1 = 1
  39. <if test=" null != id ">
  40. and `id` = #{id}
  41. </if>
  42. <if test=" null != tenantId and '' != tenantId">
  43. and `tenant_id` = #{tenantId}
  44. </if>
  45. <if test=" null != parentTenantId and '' != parentTenantId">
  46. and `parent_tenant_id` = #{parentTenantId}
  47. </if>
  48. <if test=" null != recordId ">
  49. and `record_id` = #{recordId}
  50. </if>
  51. <if test=" null != orderNo and orderNo != '' ">
  52. and `order_no` like concat('%', #{orderNo},'%')
  53. </if>
  54. <if test=" null != merchantId ">
  55. and `merchant_id` = #{merchantId}
  56. </if>
  57. <if test=" null != activityId ">
  58. and `activity_id` = #{activityId}
  59. </if>
  60. <if test=" null != activityItemId ">
  61. and `activity_item_id` = #{activityItemId}
  62. </if>
  63. <if test=" null != awardItamId ">
  64. and `award_itam_id` = #{awardItamId}
  65. </if>
  66. <if test=" null != grantId ">
  67. and `grant_id` = #{grantId}
  68. </if>
  69. <if test=" null != createDateBegin">
  70. and `create_date` &gt;= #{createDateBegin}
  71. </if>
  72. <if test=" null != createDateEnd">
  73. and `create_date` &lt;= #{createDateEnd}
  74. </if>
  75. <if test=" null != merchantIdList ">
  76. and merchant_id in
  77. <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")">
  78. #{midItem}
  79. </foreach>
  80. </if>
  81. <if test=" null != ids ">
  82. and id in
  83. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  84. #{idItem}
  85. </foreach>
  86. </if>
  87. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  88. </sql>
  89. <select id="findList" parameterType="com.iformall.domain.po.WxOfflineActivityGrantSettlement" resultMap="BaseResultMap">
  90. select <include refid="allColumns" /> from wx_offline_activity_grant_settlement
  91. <include refid="dynamicWhereConditions" />
  92. </select>
  93. <insert id="insertList" parameterType="java.util.List">
  94. insert into wx_offline_activity_grant_settlement
  95. (id,
  96. record_id,order_no,order_money,
  97. merchant_id,activity_id,activity_item_id,
  98. award_itam_id,grant_id,grant_price,
  99. mall_share_rate,merchant_share_rate,order_ratio,
  100. real_grant_price,real_mall_share_price,real_merchant_share_price,
  101. create_date,update_date)
  102. values
  103. <foreach collection="settlementList" item="item" index="index" separator=",">
  104. (#{item.id,jdbcType=BIGINT},
  105. #{item.recordId,jdbcType=BIGINT},#{item.orderNo,jdbcType=VARCHAR},#{item.orderMoney,jdbcType=DECIMAL},
  106. #{item.merchantId,jdbcType=BIGINT},#{item.activityId,jdbcType=BIGINT},#{item.activityItemId,jdbcType=BIGINT},
  107. #{item.awardItamId,jdbcType=BIGINT},#{item.grantId,jdbcType=BIGINT},#{item.grantPrice,jdbcType=DECIMAL},
  108. #{item.mallShareRate,jdbcType=DECIMAL},#{item.merchantShareRate,jdbcType=DECIMAL},#{item.orderRatio,jdbcType=DECIMAL},
  109. #{item.realGrantPrice,jdbcType=DECIMAL},#{item.realMallSharePrice,jdbcType=DECIMAL},#{item.realMerchantSharePrice,jdbcType=DECIMAL},
  110. #{item.createDate,jdbcType=TIMESTAMP},#{item.updateDate,jdbcType=TIMESTAMP})
  111. </foreach>
  112. </insert>
  113. <select id="settlementStatistics" parameterType="com.iformall.domain.po.WxOfflineActivityGrantSettlement" resultType="com.iformall.domain.vo.OfflineActivitySettlementStatistics">
  114. SELECT IFNULL(sum(real_grant_price),0) as 'sumGrantPrice',
  115. count(DISTINCT record_id) as 'recordCount',
  116. count(DISTINCT merchant_id) as 'merchantCount',
  117. IFNULL(sum(real_mall_share_price),0) as 'sumMallPrice',
  118. IFNULL(sum(real_merchant_share_price),0) as 'sumMerchantPrice'
  119. FROM wx_offline_activity_grant_settlement
  120. where 1 = 1
  121. <if test=" null != tenantId and '' != tenantId">
  122. and `tenant_id` = #{tenantId}
  123. </if>
  124. <if test=" null != parentTenantId and '' != parentTenantId">
  125. and `parent_tenant_id` = #{parentTenantId}
  126. </if>
  127. <if test=" null != activityId">
  128. and `activity_id` = #{activityId}
  129. </if>
  130. <if test=" null != createDateBegin">
  131. and `create_date` &gt;= #{createDateBegin}
  132. </if>
  133. <if test=" null != createDateEnd">
  134. and `create_date` &lt;= #{createDateEnd}
  135. </if>
  136. </select>
  137. <select id="getActivitySettlement" parameterType="com.iformall.domain.vo.OfflineActivitySettlement" resultType="com.iformall.domain.vo.OfflineActivitySettlement">
  138. SELECT merchant_id as 'merchantId',
  139. activity_id as 'activityId',
  140. count(record_id) as 'recordCount',
  141. IFNULL(sum(order_money),0) as 'sumOrderMoney',
  142. IFNULL(sum(real_grant_price),0) as 'sumGrantPrice',
  143. IFNULL(sum(real_mall_share_price),0) as 'sumMallPrice',
  144. IFNULL(sum(real_merchant_share_price),0) as 'sumMerchantPrice'
  145. FROM wx_offline_activity_grant_settlement
  146. where `activity_id` = #{activityId}
  147. <if test=" null != id ">
  148. and `id` = #{id}
  149. </if>
  150. <if test=" null != tenantId and '' != tenantId">
  151. and `tenant_id` = #{tenantId}
  152. </if>
  153. <if test=" null != parentTenantId and '' != parentTenantId">
  154. and `parent_tenant_id` = #{parentTenantId}
  155. </if>
  156. <if test=" null != merchantId ">
  157. and `merchant_id` = #{merchantId}
  158. </if>
  159. <if test=" null != merchantIdList ">
  160. and merchant_id in
  161. <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")">
  162. #{midItem}
  163. </foreach>
  164. </if>
  165. group by merchant_id
  166. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  167. </select>
  168. </mapper>