25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

312 satır
11 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.WxMerchantSubsidyMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMerchantSubsidy">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="order_id" jdbcType="BIGINT" property="orderId" />
  7. <result column="order_type" jdbcType="INTEGER" property="orderType" />
  8. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  9. <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" />
  10. <result column="coupon_type" jdbcType="INTEGER" property="couponType" />
  11. <result column="order_payment" jdbcType="INTEGER" property="orderPayment" />
  12. <result column="receiver_payment" jdbcType="INTEGER" property="receiverPayment" />
  13. <result column="real_payment" jdbcType="INTEGER" property="realPayment" />
  14. <result column="subsidy" jdbcType="INTEGER" property="subsidy" />
  15. <result column="real_subsidy" jdbcType="INTEGER" property="realSubsidy" />
  16. <result column="status" jdbcType="INTEGER" property="status" />
  17. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  18. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  19. <result column="freeze" property="freeze" />
  20. <result column="type" property="type"/>
  21. <result column="source" property="source"/>
  22. </resultMap>
  23. <sql id="allColumns">
  24. `id`,`order_id`,`order_type`,`merchant_id`,`coupon_order_id`,`coupon_type`,`order_payment`,`receiver_payment`,`real_payment`,`subsidy`,`real_subsidy`,`status`,`create_date`,`update_date`,freeze,type,source
  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 ">
  32. and `tenant_id` = #{tenantId}
  33. </if>
  34. <if test=" null != orderId ">
  35. and `order_id` = #{orderId}
  36. </if>
  37. <if test=" null != orderType ">
  38. and `order_type` = #{orderType}
  39. </if>
  40. <if test=" null != merchantId ">
  41. and `merchant_id` = #{merchantId}
  42. </if>
  43. <if test=" null != couponOrderId ">
  44. and `coupon_order_id` = #{couponOrderId}
  45. </if>
  46. <if test=" null != couponType ">
  47. and `coupon_type` = #{couponType}
  48. </if>
  49. <if test=" null != orderPayment ">
  50. and `order_payment` = #{orderPayment}
  51. </if>
  52. <if test=" null != receiverPayment ">
  53. and `receiver_payment` = #{receiverPayment}
  54. </if>
  55. <if test=" null != realPayment ">
  56. and `real_payment` = #{realPayment}
  57. </if>
  58. <if test=" null != subsidy ">
  59. and `subsidy` = #{subsidy}
  60. </if>
  61. <if test=" null != realSubsidy ">
  62. and `real_subsidy` = #{realSubsidy}
  63. </if>
  64. <if test=" null != status ">
  65. and `status` = #{status}
  66. </if>
  67. <if test=" null != createDate ">
  68. and `create_date` = #{createDate}
  69. </if>
  70. <if test=" null != updateDate ">
  71. and `update_date` = #{updateDate}
  72. </if>
  73. <if test=" null != startdate and null!=enddate">
  74. and `create_date` between #{startdate} and #{enddate}
  75. </if>
  76. <if test=" null != type">
  77. and `type` = #{type}
  78. </if>
  79. <if test=" null != source">
  80. and `source` = #{source}
  81. </if>
  82. <if test=" null != statusS ">
  83. and `status` in
  84. <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
  85. #{sItem}
  86. </foreach>
  87. </if>
  88. <if test=" null != ids ">
  89. and id in
  90. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  91. #{idItem}
  92. </foreach>
  93. </if>
  94. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  95. </sql>
  96. <select id="findList" parameterType="com.iformall.domain.po.WxMerchantSubsidy" resultMap="BaseResultMap">
  97. select <include refid="allColumns" /> from wx_merchant_subsidy
  98. <include refid="dynamicWhereConditions" />
  99. </select>
  100. <update id="updateByCond" parameterType="com.iformall.domain.po.WxMerchantSubsidy">
  101. update wx_merchant_subsidy
  102. set `status` = #{status}
  103. where 1=1
  104. <if test=" null != tenantId ">
  105. and `tenant_id`=#{tenantId}
  106. </if>
  107. <if test=" null != merchantId ">
  108. and `merchant_id`=#{merchantId}
  109. </if>
  110. <if test=" null != ids ">
  111. and id in
  112. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  113. #{idItem}
  114. </foreach>
  115. </if>
  116. </update>
  117. <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxMerchantSubsidyVo">
  118. <id column="id" jdbcType="BIGINT" property="id" />
  119. <result column="order_id" jdbcType="BIGINT" property="orderId" />
  120. <result column="order_type" jdbcType="INTEGER" property="orderType" />
  121. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  122. <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" />
  123. <result column="coupon_type" jdbcType="INTEGER" property="couponType" />
  124. <result column="order_payment" jdbcType="INTEGER" property="orderPayment" />
  125. <result column="receiver_payment" jdbcType="INTEGER" property="receiverPayment" />
  126. <result column="real_payment" jdbcType="INTEGER" property="realPayment" />
  127. <result column="subsidy" jdbcType="INTEGER" property="subsidy" />
  128. <result column="real_subsidy" jdbcType="INTEGER" property="realSubsidy" />
  129. <result column="status" jdbcType="INTEGER" property="status" />
  130. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  131. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  132. <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
  133. <result column="title" jdbcType="VARCHAR" property="title" />
  134. <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
  135. <result column="detail" jdbcType="VARCHAR" property="detail" />
  136. <result column="unit" jdbcType="INTEGER" property="unit" />
  137. <result column="remark" jdbcType="VARCHAR" property="remark" />
  138. <result column="name" jdbcType="VARCHAR" property="merchantName" />
  139. <result column="nick_name" jdbcType="VARCHAR" property="nickName" />
  140. <result column="phone" jdbcType="VARCHAR" property="phone" />
  141. <result column="freeze" property="freeze" />
  142. <result column="source" property="source"/>
  143. <result column="type" property="type"/>
  144. </resultMap>
  145. <sql id="allVoColumns">
  146. ms.`id`,ms.`tenant_id`,ms.`order_id`,ms.`order_type`,ms.`merchant_id`,ms.`coupon_order_id`,ms.`coupon_type`,
  147. ms.`order_payment`,ms.`receiver_payment`,ms.`real_payment`,
  148. ms.`subsidy`,ms.`real_subsidy`,ms.`status`,ms.`create_date`,ms.`update_date`,
  149. c.`title`,c.`sub_title`,c.`unit`,m.`name`,
  150. cu.`nick_name`, cu.`phone`,ms.freeze
  151. </sql>
  152. <sql id="dynamicVoWhereConditions">
  153. <if test=" null != id ">
  154. and t.`id` = #{id}
  155. </if>
  156. <if test=" null != tenantId ">
  157. and t.`tenant_id` = #{tenantId}
  158. </if>
  159. <if test=" null != orderId ">
  160. and t.`order_id` = #{orderId}
  161. </if>
  162. <if test=" null != orderType ">
  163. and t.`order_type` = #{orderType}
  164. </if>
  165. <if test=" null != merchantId ">
  166. and t.`merchant_id` = #{merchantId}
  167. </if>
  168. <if test=" null != couponOrderId ">
  169. and t.`coupon_order_id` = #{couponOrderId}
  170. </if>
  171. <if test=" null != couponType ">
  172. and t.`coupon_type` = #{couponType}
  173. </if>
  174. <if test=" null != orderPayment ">
  175. and t.`order_payment` = #{orderPayment}
  176. </if>
  177. <if test=" null != receiverPayment ">
  178. and t.`receiver_payment` = #{receiverPayment}
  179. </if>
  180. <if test=" null != realPayment ">
  181. and t.`real_payment` = #{realPayment}
  182. </if>
  183. <if test=" null != subsidy ">
  184. and t.`subsidy` = #{subsidy}
  185. </if>
  186. <if test=" null != realSubsidy ">
  187. and t.`real_subsidy` = #{realSubsidy}
  188. </if>
  189. <if test=" null != status ">
  190. and t.`status` = #{status}
  191. </if>
  192. <if test=" null != createDate ">
  193. and t.`create_date` = #{createDate}
  194. </if>
  195. <if test=" null != updateDate ">
  196. and t.`update_date` = #{updateDate}
  197. </if>
  198. <if test=" null != startdate and null!=enddate">
  199. and t.`create_date` between #{startdate} and #{enddate}
  200. </if>
  201. <if test=" null != title">
  202. and t.`title` like concat('%', #{title},'%')
  203. </if>
  204. <if test=" null != statusS ">
  205. and t.`status` in
  206. <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
  207. #{sItem}
  208. </foreach>
  209. </if>
  210. <if test=" null != ids ">
  211. and t.`id` in
  212. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  213. #{idItem}
  214. </foreach>
  215. </if>
  216. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  217. </sql>
  218. <select id="findVoList" parameterType="com.iformall.domain.vo.WxMerchantSubsidyVo" resultMap="VoBaseResultMap">
  219. select ms.id,ms.order_id,m.name,ms.source,ms.type,
  220. ms.create_date,ms.subsidy,ms.real_subsidy,ms.status,ms.freeze
  221. from wx_merchant_subsidy ms left join wx_merchant m on ms.merchant_id=m.id
  222. where 1=1
  223. <if test=" null != tenantId ">
  224. and ms.`tenant_id` = #{tenantId}
  225. </if>
  226. <if test=" null != orderId ">
  227. and ms.`order_id` = #{orderId}
  228. </if>
  229. <if test=" null != merchantId ">
  230. and ms.`merchant_id` = #{merchantId}
  231. </if>
  232. <if test=" null != source ">
  233. and ms.`source` = #{source}
  234. </if>
  235. <if test=" null != type ">
  236. and ms.`type` = #{type}
  237. </if>
  238. <if test=" null != status">
  239. <choose>
  240. <when test="status==0">
  241. and ms.`status` = #{status}
  242. </when>
  243. <otherwise>
  244. and ms.`status` in (1,2)
  245. </otherwise>
  246. </choose>
  247. </if>
  248. <if test=" null != freeze ">
  249. and ms.`freeze` = #{freeze}
  250. </if>
  251. <if test=" null != startdate and null!=enddate">
  252. and ms.`create_date` between #{startdate} and #{enddate}
  253. </if>
  254. </select>
  255. <select id="sumVoList" parameterType="com.iformall.domain.vo.WxMerchantSubsidyVo" resultType="hashmap">
  256. select ms.`merchant_id` merchantId, m.`name` as merchantName,
  257. IFNULL(sum(ms.`order_payment`),0) as sumOrderPayment,
  258. IFNULL(sum(ms.`receiver_payment`),0) as sumReceiverPayment,
  259. IFNULL(sum(ms.`subsidy`),0) as sumSubsidy,
  260. IFNULL(sum(ms.`real_subsidy`),0) as sumRealSubsidy
  261. from wx_merchant_subsidy ms
  262. left join wx_coupon_order co on co.id = ms.coupon_order_id
  263. left join wx_coupon c on c.id = co.coupon_id
  264. left join wx_merchant m on m.id = ms.merchant_id
  265. <where>
  266. <if test=" null != status ">
  267. and ms.`status` = #{status}
  268. </if>
  269. <if test=" null != merchantId ">
  270. and ms.`merchant_id` = #{merchantId}
  271. </if>
  272. <if test=" null != title ">
  273. and c.`title` like concat('%', #{title},'%')
  274. </if>
  275. <if test=" null != statusS ">
  276. and ms.`status` in
  277. <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
  278. #{sItem}
  279. </foreach>
  280. </if>
  281. <if test=" null != startdate and null!=enddate">
  282. and ms.`create_date` between #{startdate} and #{enddate}
  283. </if>
  284. </where>
  285. group by ms.`merchant_id`
  286. </select>
  287. </mapper>