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.
 
 
 
 
 

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