TenantPaymentOrderMapper.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. <!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
  4. <mapper namespace="com.ym.mec.biz.dal.dao.TenantPaymentOrderDao">
  5. <resultMap type="com.ym.mec.biz.dal.entity.TenantPaymentOrder"
  6. id="TenantPaymentOrder">
  7. <result column="id_" property="id" />
  8. <result column="activities_id_" property="activitiesId" />
  9. <result column="user_id_" property="userId" />
  10. <result column="real_name_" property="username" />
  11. <result column="organ_id_" property="organId" />
  12. <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
  13. <result column="trans_minutes_" property="transMinutes" />
  14. <result column="give_minutes_" property="giveMinutes" />
  15. <result column="expect_amount_" property="expectAmount" />
  16. <result column="actual_amount_" property="actualAmount" />
  17. <result column="balance_payment_amount_" property="balancePaymentAmount" />
  18. <result column="com_amount_" property="comAmount" />
  19. <result column="per_amount_" property="perAmount" />
  20. <result column="remit_fee_" property="remitFee" />
  21. <result column="trans_no_" property="transNo" />
  22. <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
  23. <result column="memo_" property="memo" />
  24. <result column="payment_channel_" property="paymentChannel" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
  25. <result column="payment_business_channel_" property="paymentBusinessChannel" />
  26. <result column="mer_nos_" property="merNos" />
  27. <result column="order_no_" property="orderNo" />
  28. <result column="pay_time_" property="payTime" />
  29. <result column="version_" property="version" />
  30. <result column="create_time_" property="createTime" />
  31. <result column="update_time_" property="updateTime" />
  32. </resultMap>
  33. <sql id="queryPaymentOrder">
  34. <where>
  35. <if test="organId != null">
  36. AND FIND_IN_SET(tpo.organ_id_,#{organId})
  37. </if>
  38. <if test="orderStartDate != null">
  39. AND DATE_FORMAT(tpo.create_time_,'%Y-%m-%d') &gt;= #{orderStartDate}
  40. </if>
  41. <if test="orderEndDate != null">
  42. AND DATE_FORMAT(tpo.create_time_,'%Y-%m-%d') &lt;= #{orderEndDate}
  43. </if>
  44. <if test="tenantPaymentType != null">
  45. AND tpo.type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  46. </if>
  47. <if test="userId != null">
  48. AND tpo.user_id_ = #{userId}
  49. </if>
  50. <if test="paymentChannel != null">
  51. AND tpo.payment_channel_ NOT IN (#{paymentChannel})
  52. </if>
  53. <if test="status != null">
  54. AND tpo.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  55. </if>
  56. </where>
  57. </sql>
  58. <!-- 根据主键查询一条记录 -->
  59. <select id="get" resultMap="TenantPaymentOrder">
  60. SELECT * FROM tenant_payment_order WHERE id_ = #{id}
  61. </select>
  62. <!-- 全查询 -->
  63. <select id="findAll" resultMap="TenantPaymentOrder">
  64. SELECT * FROM tenant_payment_order ORDER BY id_
  65. </select>
  66. <!-- 向数据库增加一条记录 -->
  67. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.TenantPaymentOrder"
  68. useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  69. <!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
  70. AS ID FROM DUAL </selectKey> -->
  71. INSERT INTO tenant_payment_order
  72. (id_,activities_id_,user_id_,organ_id_,type_,trans_minutes_,give_minutes_,expect_amount_,actual_amount_,balance_payment_amount_,com_amount_,per_amount_,remit_fee_,trans_no_,status_,memo_,payment_channel_,payment_business_channel_,mer_nos_,order_no_,pay_time_,version_,create_time_,update_time_)
  73. VALUES(#{id},#{activitiesId},#{userId},#{organId},#{type, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{transMinutes},#{giveMinutes},#{expectAmount},#{actualAmount},#{balancePaymentAmount},#{comAmount},#{perAmount},#{remitFee},#{transNo},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{memo},#{paymentChannel},#{paymentBusinessChannel},#{merNos},#{orderNo},#{payTime},#{version},#{createTime},#{updateTime})
  74. </insert>
  75. <!-- 根据主键查询一条记录 -->
  76. <update id="update" parameterType="com.ym.mec.biz.dal.entity.TenantPaymentOrder">
  77. UPDATE tenant_payment_order
  78. <set>
  79. <if test="status != null">
  80. status_ = #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  81. </if>
  82. <if test="transMinutes != null">
  83. trans_minutes_ = #{transMinutes},
  84. </if>
  85. <if test="giveMinutes != null">
  86. give_minutes_ = #{giveMinutes},
  87. </if>
  88. <if test="organId != null">
  89. organ_id_ = #{organId},
  90. </if>
  91. <if test="activitiesId != null">
  92. activities_id_ = #{activitiesId},
  93. </if>
  94. <if test="comAmount != null">
  95. com_amount_ = #{comAmount},
  96. </if>
  97. <if test="orderNo != null">
  98. order_no_ = #{orderNo},
  99. </if>
  100. <if test="id != null">
  101. id_ = #{id},
  102. </if>
  103. <if test="perAmount != null">
  104. per_amount_ = #{perAmount},
  105. </if>
  106. <if test="expectAmount != null">
  107. expect_amount_ = #{expectAmount},
  108. </if>
  109. <if test="balancePaymentAmount != null">
  110. balance_payment_amount_ = #{balancePaymentAmount},
  111. </if>
  112. <if test="version != null">
  113. version_ = #{version},
  114. </if>
  115. <if test="memo != null">
  116. memo_ = #{memo},
  117. </if>
  118. <if test="paymentChannel != null">
  119. payment_channel_ = #{paymentChannel},
  120. </if>
  121. <if test="remitFee != null">
  122. remit_fee_ = #{remitFee},
  123. </if>
  124. <if test="createTime != null">
  125. create_time_ = #{createTime},
  126. </if>
  127. <if test="userId != null">
  128. user_id_ = #{userId},
  129. </if>
  130. <if test="paymentBusinessChannel != null">
  131. payment_business_channel_ = #{paymentBusinessChannel},
  132. </if>
  133. <if test="updateTime != null">
  134. update_time_ = #{updateTime},
  135. </if>
  136. <if test="transNo != null">
  137. trans_no_ = #{transNo},
  138. </if>
  139. <if test="actualAmount != null">
  140. actual_amount_ = #{actualAmount},
  141. </if>
  142. <if test="type != null">
  143. type_ = #{type, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  144. </if>
  145. <if test="merNos != null">
  146. mer_nos_ = #{merNos},
  147. </if>
  148. <if test="payTime != null">
  149. pay_time_ = #{payTime},
  150. </if>
  151. </set>
  152. WHERE id_ = #{id}
  153. </update>
  154. <!-- 根据主键删除一条记录 -->
  155. <delete id="delete">
  156. DELETE FROM tenant_payment_order WHERE id_ = #{id}
  157. </delete>
  158. <!-- 分页查询 -->
  159. <select id="queryPage" resultMap="TenantPaymentOrder"
  160. parameterType="map">
  161. SELECT tpo.*,su.real_name_ FROM tenant_payment_order tpo
  162. LEFT JOIN sys_user su ON su.id_ = tpo.user_id_
  163. <include refid="queryPaymentOrder"/>
  164. ORDER BY tpo.id_
  165. <include refid="global.limit" />
  166. </select>
  167. <!-- 查询当前表的总记录数 -->
  168. <select id="queryCount" resultType="int">
  169. SELECT COUNT(tpo.id_) FROM tenant_payment_order tpo
  170. <include refid="queryPaymentOrder"/>
  171. </select>
  172. <select id="queryByUserId" resultMap="TenantPaymentOrder">
  173. SELECT * FROM tenant_payment_order where user_id_ = #{userId} ORDER BY id_
  174. </select>
  175. <select id="queryByUserIdAndActivitiesId" resultMap="TenantPaymentOrder" parameterType="map">
  176. SELECT * FROM tenant_payment_order where user_id_ = #{userId} and activities_id_ = #{activitiesId} ORDER BY id_
  177. </select>
  178. <!-- 根据订单号查询订单 -->
  179. <select id="findOrderByOrderNo" resultMap="TenantPaymentOrder">
  180. SELECT * FROM tenant_payment_order WHERE order_no_ = #{orderNo}
  181. </select>
  182. <select id="findOrdersByStatus" resultMap="TenantPaymentOrder">
  183. SELECT * FROM tenant_payment_order
  184. WHERE status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  185. AND payment_channel_ = #{paymentChannel}
  186. LIMIT 100
  187. </select>
  188. </mapper>