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.
 
 
 
 
 

174 righe
6.9 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="c_user_id" jdbcType="BIGINT" property="cUserId" />
  10. <result column="owner_user_id" jdbcType="BIGINT" property="ownerUserId" />
  11. <result column="type" jdbcType="INTEGER" property="type" />
  12. <result column="coupon_password_id" jdbcType="BIGINT" property="couponPasswordId" />
  13. <result column="coupon_password" jdbcType="VARCHAR" property="couponPassword" />
  14. <result column="pay_check" jdbcType="INTEGER" property="payCheck" />
  15. <result column="pay_password" jdbcType="VARCHAR" property="payPassword" />
  16. <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" />
  17. <result column="amount" jdbcType="INTEGER" property="amount" />
  18. <result column="sale_amount" jdbcType="INTEGER" property="saleAmount" />
  19. <result column="remaining_amount" jdbcType="INTEGER" property="remainingAmount" />
  20. <result column="service_fee_amount" jdbcType="INTEGER" property="serviceFeeAmount" />
  21. <result column="share_fee_amount" jdbcType="INTEGER" property="shareFeeAmount" />
  22. <result column="remaining_share_fee_amount" jdbcType="INTEGER" property="remainingShareFeeAmount" />
  23. <result column="rate_amount" jdbcType="INTEGER" property="rateAmount" />
  24. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  25. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  26. <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
  27. <result column="status" jdbcType="INTEGER" property="status"/>
  28. </resultMap>
  29. <sql id="allColumns">
  30. `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`c_user_id`,`owner_user_id`,`coupon_password_id`,`coupon_password`,`pay_check`,`type`,
  31. `transaction_id`,`amount`,`sale_amount`,`remaining_amount`,`service_fee_amount`,`share_fee_amount`,`remaining_share_fee_amount`,
  32. `rate_amount`,`create_date`,`update_date`,`support_transfer`,`status`
  33. </sql>
  34. <sql id="dynamicWhereConditions">
  35. where `tenant_id` = #{tenantId}
  36. <if test=" null != id ">
  37. and `id` = #{id}
  38. </if>
  39. <if test=" null != parentTenantId and '' != parentTenantId">
  40. and `parent_tenant_id` = #{parentTenantId}
  41. </if>
  42. <if test=" null != couponId ">
  43. and `coupon_id` = #{couponId}
  44. </if>
  45. <if test=" null != cUserId ">
  46. and `c_user_id` = #{cUserId}
  47. </if>
  48. <if test=" null != ownerUserId ">
  49. and `owner_user_id` = #{ownerUserId}
  50. </if>
  51. <if test=" null != type ">
  52. and `type` = #{type}
  53. </if>
  54. <if test=" null != transactionId ">
  55. and `transaction_id` = #{transactionId}
  56. </if>
  57. <if test=" null != amount ">
  58. and `amount` = #{amount}
  59. </if>
  60. <if test=" null != saleAmount ">
  61. and `sale_amount` = #{saleAmount}
  62. </if>
  63. <if test=" null != remainingAmount ">
  64. and `remaining_amount` = #{remainingAmount}
  65. </if>
  66. <if test=" null != serviceFeeAmount ">
  67. and `service_fee_amount` = #{serviceFeeAmount}
  68. </if>
  69. <if test=" null != shareFeeAmount ">
  70. and `share_fee_amount` = #{shareFeeAmount}
  71. </if>
  72. <if test=" null != remainingShareFeeAmount ">
  73. and `remaining_share_fee_amount` = #{remainingShareFeeAmount}
  74. </if>
  75. <if test=" null != rateAmount ">
  76. and `rate_amount` = #{rateAmount}
  77. </if>
  78. <if test=" null != createDate ">
  79. and `create_date` = #{createDate}
  80. </if>
  81. <if test=" null != updateDate ">
  82. and `update_date` = #{updateDate}
  83. </if>
  84. <if test=" null != couponPasswordId">
  85. and `coupon_password_id` = #{couponPasswordId}
  86. </if>
  87. <if test=" null != couponPasswordIdLike">
  88. and `coupon_password_id` like concat('%',#{couponPasswordIdLike},'%')
  89. </if>
  90. <if test=" null != couponPassword">
  91. and `coupon_password` like concat('%',#{couponPassword},'%')
  92. </if>
  93. <if test=" null != startdate ">
  94. and `create_date` &gt;= #{startdate}
  95. </if>
  96. <if test=" null != enddate">
  97. and `create_date` &lt;= #{enddate}
  98. </if>
  99. <if test=" null != status">
  100. and `status` = #{status}
  101. </if>
  102. <if test=" null != couponPasswordIdList ">
  103. and coupon_password_id in
  104. <foreach collection="couponPasswordIdList" index="index" item="cpidItem" open="(" separator="," close=")">
  105. #{cpidItem}
  106. </foreach>
  107. </if>
  108. <if test=" null != couponIdList ">
  109. and coupon_id in
  110. <foreach collection="couponIdList" index="index" item="cidItem" open="(" separator="," close=")">
  111. #{cidItem}
  112. </foreach>
  113. </if>
  114. <if test=" null != cUserIdList ">
  115. and c_user_id in
  116. <foreach collection="cUserIdList" index="index" item="cuidItem" open="(" separator="," close=")">
  117. #{cuidItem}
  118. </foreach>
  119. </if>
  120. <if test=" null != ownerUserIdList ">
  121. and owner_user_id in
  122. <foreach collection="ownerUserIdList" index="index" item="ouidItem" open="(" separator="," close=")">
  123. #{ouidItem}
  124. </foreach>
  125. </if>
  126. <if test=" null != ids ">
  127. and id in
  128. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  129. #{idItem}
  130. </foreach>
  131. </if>
  132. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  133. </sql>
  134. <update id="updateTransferStatusByCouponId" parameterType="Long">
  135. update wx_card_info set support_transfer=0,update_date=now() where support_transfer=1 and coupon_id=#{couponId}
  136. </update>
  137. <select id="findList" parameterType="com.iformall.domain.po.WxCardInfo" resultMap="BaseResultMap">
  138. select <include refid="allColumns" />
  139. from wx_card_info
  140. <include refid="dynamicWhereConditions" />
  141. </select>
  142. <select id="findIdList" parameterType="com.iformall.domain.po.WxCardInfo" resultType="Long">
  143. select id from wx_card_info
  144. <include refid="dynamicWhereConditions" />
  145. </select>
  146. <update id="updateStatus" parameterType="com.iformall.domain.po.WxCardInfo">
  147. update wx_card_info set status=#{status},update_date=now() where id=#{id} and tenant_id = #{tenantId}
  148. </update>
  149. <update id="updAmount" parameterType="com.iformall.domain.po.WxCardInfo">
  150. update wx_card_info set
  151. <if test=" null != amount ">
  152. `amount` = amount+#{amount},
  153. </if>
  154. <if test=" null != remainingAmount ">
  155. `remaining_amount` = remaining_amount+#{remainingAmount},
  156. </if>
  157. <if test=" null != remainingShareFeeAmount ">
  158. `remaining_share_fee_amount` = remaining_share_fee_amount+#{remainingShareFeeAmount},
  159. </if>
  160. update_date=now()
  161. where id=#{id} and tenant_id = #{tenantId}
  162. and remaining_amount+#{remainingAmount} >= 0
  163. </update>
  164. </mapper>