Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

190 linhas
7.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.WxThirdPartyOrdersMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxThirdPartyOrders">
  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="source_app_id" jdbcType="VARCHAR" property="sourceAppId"/>
  9. <result column="source_type" jdbcType="INTEGER" property="sourceType"/>
  10. <result column="shop_name" jdbcType="VARCHAR" property="shopName" />
  11. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber" />
  12. <result column="user_phone" jdbcType="VARCHAR" property="userPhone" />
  13. <result column="user_number" jdbcType="VARCHAR" property="userNumber" />
  14. <result column="time_end" jdbcType="TIMESTAMP" property="timeEnd"/>
  15. <result column="amount" jdbcType="INTEGER" property="amount"/>
  16. <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" />
  17. <result column="summary" jdbcType="VARCHAR" property="summary" />
  18. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  19. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  20. <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
  21. <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/>
  22. <result column="earn_points" jdbcType="TINYINT" property="earnPoints"/>
  23. <result column="increased_points" jdbcType="INTEGER" property="increasedPoints"/>
  24. <result column="points_update_time" jdbcType="TIMESTAMP" property="pointsUpdateTime"/>
  25. <result column="is_refund" jdbcType="TINYINT" property="isRefund"/>
  26. <result column="refund_summary" jdbcType="VARCHAR" property="refundSummary" />
  27. <result column="refund_time" jdbcType="TIMESTAMP" property="refundTime"/>
  28. <result column="refund_amount" jdbcType="INTEGER" property="refundAmount"/>
  29. <result column="refund_id" jdbcType="VARCHAR" property="refundId" />
  30. <result column="is_refund_points" jdbcType="TINYINT" property="isRefundPoints"/>
  31. <result column="refund_points_time" jdbcType="TIMESTAMP" property="refundPointsTime"/>
  32. </resultMap>
  33. <sql id="allColumns">
  34. `id`, `tenant_id`, `parent_tenant_id`, `source_app_id`, `source_type`, `shop_name`, `shop_number`,
  35. `user_phone`, `user_number`, `time_end`, `amount`, `transaction_id`, `summary`,
  36. `create_time`, `update_time`, `merchant_id`, `c_user_id`,
  37. `earn_points`, `increased_points`, `points_update_time`,
  38. `is_refund`, `refund_summary`, `refund_time`, `refund_amount`, `refund_id`,
  39. `is_refund_points`, `refund_points_time`
  40. </sql>
  41. <sql id="dynamicWhereConditions">
  42. where 1 = 1
  43. <if test=" null != id ">
  44. and `id` = #{id}
  45. </if>
  46. <if test=" null != tenantId and '' != tenantId">
  47. and `tenant_id` = #{tenantId}
  48. </if>
  49. <if test=" null != parentTenantId and '' != parentTenantId">
  50. and `parent_tenant_id` = #{parentTenantId}
  51. </if>
  52. <if test=" null != sourceAppId and '' != sourceAppId">
  53. and `source_app_id` = #{sourceAppId}
  54. </if>
  55. <if test=" null != sourceType and '' != sourceType">
  56. and `source_type` = #{sourceType}
  57. </if>
  58. <if test=" null != shopName ">
  59. and `shop_name` like concat('%', #{shopName},'%')
  60. </if>
  61. <if test=" null != shopNumber and '' != shopNumber">
  62. and `shop_number` = #{shopNumber}
  63. </if>
  64. <if test=" null != userPhone and '' != userPhone">
  65. and `user_phone` = #{userPhone}
  66. </if>
  67. <if test=" null != userNumber and '' != userNumber">
  68. and `user_number` = #{userNumber}
  69. </if>
  70. <if test=" null != startTime ">
  71. and `time_end` &gt;= #{startTime}
  72. </if>
  73. <if test=" null != endTime">
  74. and `time_end` &lt; #{endTime}
  75. </if>
  76. <if test=" null != transactionId and '' != transactionId">
  77. and `transaction_id` = #{transactionId}
  78. </if>
  79. <if test=" null != merchantId ">
  80. and `merchant_id` = #{merchantId}
  81. </if>
  82. <if test=" null != cUserId ">
  83. and `c_user_id` = #{cUserId}
  84. </if>
  85. <if test=" null != earnPoints ">
  86. and `earn_points` = #{earnPoints}
  87. </if>
  88. <if test=" null != isRefund ">
  89. and `is_refund` = #{isRefund}
  90. </if>
  91. <if test=" null != refundId and '' != refundId">
  92. and `refund_id` = #{refundId}
  93. </if>
  94. <if test=" null != isRefundPoints">
  95. and `is_refund_points` = #{isRefundPoints}
  96. </if>
  97. <if test=" null != ids ">
  98. and `id` in
  99. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  100. #{idItem}
  101. </foreach>
  102. </if>
  103. <if test=" null != sortColumns">order by ${sortColumns}</if>
  104. </sql>
  105. <select id="findList" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap">
  106. select
  107. <include refid="allColumns"/>
  108. from wx_third_party_orders
  109. <include refid="dynamicWhereConditions"/>
  110. </select>
  111. <select id="getById" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap">
  112. select
  113. <include refid="allColumns"/>
  114. from wx_third_party_orders
  115. where `id` = #{id}
  116. and tenant_id=#{tenantId}
  117. </select>
  118. <select id="getByTransactionId" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap">
  119. select
  120. <include refid="allColumns"/>
  121. from wx_third_party_orders
  122. where `transaction_id` = #{transactionId}
  123. and tenant_id=#{tenantId}
  124. </select>
  125. <insert id="insertNoticeOrder" parameterType="com.iformall.domain.po.WxThirdPartyOrders" >
  126. INSERT INTO wx_business_circle_order (
  127. `id`, `tenant_id`, `parent_tenant_id`, `source_app_id`,`source_type`,`shop_name`, `shop_number`,
  128. `user_phone`, `user_number`, `time_end`, `amount`, `transaction_id`, `summary`,
  129. `create_time`, `update_time`, `merchant_id`, `c_user_id`, `earn_points`, `is_refund`
  130. )
  131. VALUES(
  132. #{id},#{tenantId},#{parentTenantId},#{sourceAppId},#{sourceType},#{shopName},#{shopNumber},
  133. #{userPhone},#{userNumber},#{timeEnd},#{amount},#{transactionId},#{summary},
  134. #{createTime},#{updateTime}, #{merchantId},#{cUserId},0,0
  135. );
  136. </insert>
  137. <update id="updateAddPoints" parameterType="com.iformall.domain.po.WxThirdPartyOrders">
  138. update wx_business_circle_order set
  139. `earn_points` = 1, `increased_points` = #{increasedPoints}, `points_update_time` = #{pointsUpdateTime},
  140. `is_refund_points` = 0, `update_time` = #{updateTime}
  141. where `id` = #{id} and `tenant_id` = #{tenantId}
  142. </update>
  143. <update id="updateRefundNoticeOrder" parameterType="com.iformall.domain.po.WxThirdPartyOrders">
  144. update wx_business_circle_order set
  145. `is_refund` = 1, `refund_summary` = #{refundSummary},
  146. `refund_time` = #{refundTime}, `refund_amount` = #{refundAmount}, `refund_id` = #{refundId},
  147. `update_time` = #{updateTime}
  148. where `id` = #{id} and `tenant_id` = #{tenantId}
  149. </update>
  150. <update id="updateRefundPoints" parameterType="com.iformall.domain.po.WxThirdPartyOrders">
  151. update wx_business_circle_order set
  152. `is_refund_points` = 1, `refund_points_time` = #{refundPointsTime}, `update_time` = #{updateTime}
  153. where `id` = #{id} and `tenant_id` = #{tenantId}
  154. </update>
  155. </mapper>