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.
 
 
 
 
 

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