后台服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 rivejä
9.8 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.WxCardInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCardInfo">
  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="coupon_id" jdbcType="BIGINT" property="couponId" />
  9. <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" />
  10. <result column="amount" jdbcType="INTEGER" property="amount" />
  11. <result column="sale_amount" jdbcType="INTEGER" property="saleAmount" />
  12. <result column="remaining_amount" jdbcType="INTEGER" property="remainingAmount" />
  13. <result column="service_fee_amount" jdbcType="INTEGER" property="serviceFeeAmount" />
  14. <result column="share_fee_amount" jdbcType="INTEGER" property="shareFeeAmount" />
  15. <result column="remaining_share_fee_amount" jdbcType="INTEGER" property="remainingShareFeeAmount" />
  16. <result column="rate_amount" jdbcType="INTEGER" property="rateAmount" />
  17. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  18. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  19. <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
  20. </resultMap>
  21. <sql id="allColumns">
  22. `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`transaction_id`,
  23. `amount`,`sale_amount`,`remaining_amount`,`service_fee_amount`,
  24. `share_fee_amount`,`remaining_share_fee_amount`, `rate_amount`,
  25. `create_date`,`update_date`,`support_transfer`
  26. </sql>
  27. <sql id="dynamicWhereConditions">
  28. where 1 = 1
  29. <if test=" null != id ">
  30. and `id` = #{id}
  31. </if>
  32. <if test=" null != tenantId and '' != tenantId">
  33. and `tenant_id` = #{tenantId}
  34. </if>
  35. <if test=" null != parentTenantId and '' != parentTenantId">
  36. and `parent_tenant_id` = #{parentTenantId}
  37. </if>
  38. <if test=" null != couponId ">
  39. and `coupon_id` = #{couponId}
  40. </if>
  41. <if test=" null != transactionId ">
  42. and `transaction_id` = #{transactionId}
  43. </if>
  44. <if test=" null != amount ">
  45. and `amount` = #{amount}
  46. </if>
  47. <if test=" null != saleAmount ">
  48. and `sale_amount` = #{saleAmount}
  49. </if>
  50. <if test=" null != remainingAmount ">
  51. and `remaining_amount` = #{remainingAmount}
  52. </if>
  53. <if test=" null != serviceFeeAmount ">
  54. and `service_fee_amount` = #{serviceFeeAmount}
  55. </if>
  56. <if test=" null != shareFeeAmount ">
  57. and `share_fee_amount` = #{shareFeeAmount}
  58. </if>
  59. <if test=" null != remainingShareFeeAmount ">
  60. and `remaining_share_fee_amount` = #{remainingShareFeeAmount}
  61. </if>
  62. <if test=" null != rateAmount ">
  63. and `rate_amount` = #{rateAmount}
  64. </if>
  65. <if test=" null != createDate ">
  66. and `create_date` = #{createDate}
  67. </if>
  68. <if test=" null != updateDate ">
  69. and `update_date` = #{updateDate}
  70. </if>
  71. <if test=" null != startdate and null!=enddate">
  72. and `create_date` between #{startdate} and #{enddate}
  73. </if>
  74. <if test=" null != ids ">
  75. and id in
  76. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  77. #{idItem}
  78. </foreach>
  79. </if>
  80. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  81. </sql>
  82. <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCardVo">
  83. <id column="id" jdbcType="BIGINT" property="id" />
  84. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  85. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  86. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  87. <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" />
  88. <result column="amount" jdbcType="INTEGER" property="amount" />
  89. <result column="sale_amount" jdbcType="INTEGER" property="saleAmount" />
  90. <result column="remaining_amount" jdbcType="INTEGER" property="remainingAmount" />
  91. <result column="service_fee_amount" jdbcType="INTEGER" property="serviceFeeAmount" />
  92. <result column="share_fee_amount" jdbcType="INTEGER" property="shareFeeAmount" />
  93. <result column="remaining_share_fee_amount" jdbcType="INTEGER" property="remainingShareFeeAmount" />
  94. <result column="rate_amount" jdbcType="INTEGER" property="rateAmount" />
  95. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  96. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  97. <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
  98. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture" />
  99. <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture" />
  100. <result column="title" jdbcType="VARCHAR" property="title" />
  101. <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
  102. <result column="detail" jdbcType="VARCHAR" property="detail" />
  103. <result column="unit" jdbcType="INTEGER" property="unit" />
  104. <result column="remark" jdbcType="VARCHAR" property="remark" />
  105. <result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
  106. <result column="price" jdbcType="INTEGER" property="price"/>
  107. <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/>
  108. <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/>
  109. <result column="c_user_id" jdbcType="BIGINT" property="cuserId" />
  110. <result column="owner_id" jdbcType="BIGINT" property="ownerId" />
  111. <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
  112. <result column="status" jdbcType="INTEGER" property="status"/>
  113. <result column="c_nick_name" jdbcType="VARCHAR" property="cnickName"/>
  114. <result column="o_nick_name" jdbcType="VARCHAR" property="onickName"/>
  115. <result column="ou_phone" jdbcType="VARCHAR" property="ouPhone"/>
  116. </resultMap>
  117. <sql id="allVoColumns">
  118. ci.`id`,ci.`tenant_id`,ci.`parent_tenant_id`,ci.`coupon_id`,ci.`transaction_id`,
  119. ci.`amount`,ci.`sale_amount`,ci.`remaining_amount`,ci.`service_fee_amount`,
  120. ci.`share_fee_amount`,ci.`remaining_share_fee_amount`, ci.`rate_amount`,
  121. ci.`create_date`,ci.`update_date`,
  122. c.`cover_img`, c.`cover_picture`,c.`detail_picture`,c.`title`, c.`sub_title`, c.`detail`,
  123. c.`unit`, c.`remark`, c.`sale_price`, c.`price`, c.`subsidy_type`, c.`subsidy_num`,
  124. co.`c_user_id`, co.`owner_id`, co.`expired_time`, co.`coupon_order_status` as status,
  125. ou.`nick_name` as c_nick_name, ou.`nick_name` as o_nick_name, ou.`phone` as ou_phone
  126. </sql>
  127. <sql id="dynamicVoWhereConditions">
  128. where 1 = 1
  129. <if test=" null != id ">
  130. and ci.`id` = #{id}
  131. </if>
  132. <if test=" null != tenantId and '' != tenantId">
  133. and ci.`tenant_id` = #{tenantId}
  134. </if>
  135. <if test=" null != parentTenantId and '' != parentTenantId">
  136. and ci.`parent_tenant_id` = #{parentTenantId}
  137. </if>
  138. <if test=" null != couponId ">
  139. and ci.`coupon_id` = #{couponId}
  140. </if>
  141. <if test=" null != transactionId ">
  142. and ci.`transaction_id` = #{transactionId}
  143. </if>
  144. <if test=" null != amount ">
  145. and ci.`amount` = #{amount}
  146. </if>
  147. <if test=" null != saleAmount ">
  148. and ci.`sale_amount` = #{saleAmount}
  149. </if>
  150. <if test=" null != remainingAmount ">
  151. and ci.`remaining_amount` = #{remainingAmount}
  152. </if>
  153. <if test=" null != serviceFeeAmount ">
  154. and ci.`service_fee_amount` = #{serviceFeeAmount}
  155. </if>
  156. <if test=" null != shareFeeAmount ">
  157. and ci.`share_fee_amount` = #{shareFeeAmount}
  158. </if>
  159. <if test=" null != remainingShareFeeAmount ">
  160. and ci.`remaining_share_fee_amount` = #{remainingShareFeeAmount}
  161. </if>
  162. <if test=" null != rateAmount ">
  163. and ci.`rate_amount` = #{rateAmount}
  164. </if>
  165. <if test=" null != createDate ">
  166. and ci.`create_date` = #{createDate}
  167. </if>
  168. <if test=" null != updateDate ">
  169. and ci.`update_date` = #{updateDate}
  170. </if>
  171. <if test=" null != status ">
  172. and co.`coupon_order_status` = #{status}
  173. </if>
  174. <if test=" null != ouPhone and '' != ouPhone">
  175. and ou.`phone` = #{ouPhone}
  176. </if>
  177. <if test=" null != startdate and null!=enddate">
  178. and ci.`create_date` between #{startdate} and #{enddate}
  179. </if>
  180. <if test=" null != onickName and ''!=onickName">
  181. and ou.`nick_name` like concat('%',#{onickName},'%')
  182. </if>
  183. <if test=" null != statusS ">
  184. and co.`coupon_order_status` in
  185. <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
  186. #{sItem}
  187. </foreach>
  188. </if>
  189. <if test=" null != ids ">
  190. and ci.id in
  191. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  192. #{idItem}
  193. </foreach>
  194. </if>
  195. order by ci.id desc
  196. </sql>
  197. <select id="findVoList" parameterType="com.iformall.domain.vo.WxCardVo" resultMap="VoBaseResultMap">
  198. select <include refid="allVoColumns" />
  199. <!--from (select ci.`id`, ci.`tenant_id`, ci.`coupon_id`, ci.`transaction_id`, ci.`amount`, ci.`sale_amount`, ci.`remaining_amount`, ci.`service_fee_amount`, ci.`share_fee_amount`, ci.`remaining_share_fee_amount`, ci.`rate_amount`, ci.`create_date`, ci.`update_date` from wx_card_info ci where ci.`tenant_id` = #{tenantId}) ci-->
  200. from wx_card_info ci
  201. left join wx_coupon c on c.id = ci.coupon_id
  202. left join wx_coupon_order co on co.id = ci.id
  203. left join wx_c_user_basic_info ou on ou.id = co.owner_id
  204. <include refid="dynamicVoWhereConditions" />
  205. </select>
  206. <update id="updateTransferStatusByCouponId" parameterType="Long">
  207. update wx_card_info set support_transfer=0,update_date=now() where support_transfer=1 and coupon_id=#{couponId}
  208. </update>
  209. <select id="findList" parameterType="com.iformall.domain.po.WxCardInfo" resultMap="BaseResultMap">
  210. select <include refid="allColumns" />
  211. from wx_card_info
  212. <include refid="dynamicWhereConditions" />
  213. </select>
  214. </mapper>