Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

189 wiersze
6.2 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.WxMerchantTradeDailyMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMerchantTradeDaily">
  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="b_user_id" jdbcType="BIGINT" property="bUserId" />
  9. <result column="trade_amt" jdbcType="DECIMAL" property="tradeAmt" />
  10. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  11. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  12. <result column="report_date" jdbcType="VARCHAR" property="reportDate" />
  13. <result column="trade_count" property="tradeCount" />
  14. <result column="proof" property="proof"/>
  15. </resultMap>
  16. <sql id="allColumns">
  17. `id`,`tenant_id`,`merchant_id`,`b_user_id`,`trade_amt`,`create_date`,`update_date`,`report_date`,trade_count,proof
  18. </sql>
  19. <sql id="dynamicWhereConditions">
  20. where 1 = 1
  21. <if test=" null != id ">
  22. and `id` = #{id}
  23. </if>
  24. <if test=" null != tenantId ">
  25. and `tenant_id` = #{tenantId}
  26. </if>
  27. <if test=" null != merchantId ">
  28. and `merchant_id` = #{merchantId}
  29. </if>
  30. <if test=" null != bUserId ">
  31. and `b_user_id` = #{bUserId}
  32. </if>
  33. <if test=" null != tradeAmt ">
  34. and `trade_amt` = #{tradeAmt}
  35. </if>
  36. <if test=" null != createDate ">
  37. and `create_date` = #{createDate}
  38. </if>
  39. <if test=" null != updateDate ">
  40. and `update_date` = #{updateDate}
  41. </if>
  42. <if test=" null != reportDate ">
  43. and `report_date` = #{reportDate}
  44. </if>
  45. <if test=" null != month ">
  46. and date_format(create_date,'%Y-%m')=#{month}
  47. </if>
  48. <if test=" null != ids ">
  49. and id in
  50. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  51. #{idItem}
  52. </foreach>
  53. </if>
  54. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  55. <if test=" null == sortColumns"> order by report_date desc </if>
  56. </sql>
  57. <select id="findList" parameterType="com.iformall.domain.po.WxMerchantTradeDaily" resultMap="BaseResultMap">
  58. select <include refid="allColumns" /> from wx_merchant_trade_daily
  59. <include refid="dynamicWhereConditions" />
  60. </select>
  61. <select id="findListOfWeek" parameterType="com.iformall.domain.po.WxMerchantTradeDaily" resultMap="BaseResultMap">
  62. select <include refid="allColumns" /> from wx_merchant_trade_daily
  63. where 1=1
  64. <if test="reportDate!=null">
  65. and `report_date` != #{reportDate}
  66. </if>
  67. <if test=" null != tenantId ">
  68. and `tenant_id` = #{tenantId}
  69. </if>
  70. <if test=" null != merchantId ">
  71. and `merchant_id` = #{merchantId}
  72. </if>
  73. order by create_date desc LIMIT 7
  74. </select>
  75. <resultMap id="BaseResultMapVo" type="com.iformall.domain.vo.WxMerchantTradeDailyVo">
  76. <id column="id" jdbcType="BIGINT" property="id" />
  77. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  78. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  79. <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
  80. <result column="trade_amt" jdbcType="DECIMAL" property="tradeAmt" />
  81. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  82. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  83. <result column="report_date" jdbcType="VARCHAR" property="reportDate" />
  84. <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />
  85. <result column="b_user_name" jdbcType="VARCHAR" property="bUserName" />
  86. <result column="b_user_phone" jdbcType="VARCHAR" property="bUserPhone"/>
  87. <result column="trade_count" property="tradeCount" />
  88. <result column="proof" property="proof"/>
  89. </resultMap>
  90. <sql id="allColumnsVo">
  91. mtd.id as id,
  92. m.tenant_id as tenant_id, m.id as merchant_id,m.name as merchant_name,
  93. mtd.b_user_id as b_user_id, mtd.trade_amt as trade_amt, mtd.create_date as create_date,mtd.update_date as update_date,mtd.report_date as report_date,
  94. mbu.name as b_user_name, mbu.phone as b_user_phone,
  95. trade_count,proof
  96. </sql>
  97. <select id="findListVo" parameterType="com.iformall.domain.vo.WxMerchantTradeDailyVo" resultMap="BaseResultMapVo">
  98. select <include refid="allColumnsVo" />
  99. from wx_merchant m
  100. left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id
  101. <if test=" reportDate!=null">
  102. and mtd.report_date = #{reportDate}
  103. </if>
  104. left join wx_merchant_b_user mbu on mtd.b_user_id = mbu.id
  105. where 1=1
  106. and m.status = 1
  107. <if test=" null != merchantName and ''!=merchantName">
  108. and m.name like concat('%', #{merchantName},'%')
  109. </if>
  110. <if test=" null != tenantId ">
  111. and m.tenant_id = #{tenantId}
  112. </if>
  113. <if test=" null != merchantId ">
  114. and m.id = #{merchantId}
  115. </if>
  116. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  117. </select>
  118. <select id="findListVoOfMonth" parameterType="com.iformall.domain.po.WxMerchantTradeDaily" resultMap="BaseResultMapVo">
  119. select <include refid="allColumnsVo" />
  120. from wx_merchant_trade_daily mtd
  121. inner join wx_merchant m on mtd.merchant_id = m.id
  122. left join wx_merchant_b_user mbu on mtd.b_user_id = mbu.id
  123. where 1 = 1
  124. <if test=" null != tenantId ">
  125. and mtd.tenant_id = #{tenantId}
  126. </if>
  127. <if test=" null != merchantId ">
  128. and mtd.merchant_id = #{merchantId}
  129. </if>
  130. order by mtd.create_date desc LIMIT 30
  131. </select>
  132. <resultMap id="BaseTotalResultMap" type="com.iformall.domain.po.WxMerchantTradeDaily">
  133. <result column="trade_amt" jdbcType="DECIMAL" property="tradeAmt" />
  134. <result column="report_date" jdbcType="VARCHAR" property="reportDate" />
  135. </resultMap>
  136. <select id="findTotalListOfMonth" parameterType="com.iformall.domain.po.WxMerchantTradeDaily" resultMap="BaseTotalResultMap">
  137. select report_date, IFNULL(sum(mtd.trade_amt),0) as trade_amt
  138. from wx_merchant_trade_daily mtd
  139. where 1 = 1
  140. <if test=" null != tenantId ">
  141. and mtd.tenant_id = #{tenantId}
  142. </if>
  143. <if test=" null != reportDate ">
  144. and mtd.report_date = #{reportDate}
  145. </if>
  146. group by mtd.report_date
  147. order by mtd.report_date desc
  148. LIMIT 30
  149. </select>
  150. </mapper>