UserBillingMapper.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.system.mapper.UserBillingMapper">
  6. <resultMap type="UserBilling" id="UserBillingResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="type" column="type" />
  10. <result property="ddId" column="dd_id" />
  11. <result property="amount" column="amount" />
  12. <result property="state" column="state" />
  13. <result property="illustrate" column="illustrate" />
  14. <result property="paymentMethod" column="payment_method" />
  15. <result property="accountNumber" column="account_number" />
  16. <result property="mdId" column="md_id" />
  17. <result property="divvy" column="divvy" />
  18. <result property="balancePay" column="balance_pay" />
  19. <result property="userType" column="user_type" />
  20. <result property="cretim" column="cretim" />
  21. <result property="divvyRate" column="divvy_rate" />
  22. <result property="behalfAmount" column="behalf_amount" />
  23. <result property="walletBalance" column="wallet_balance" />
  24. <result property="tax" column="tax" />
  25. <result property="taxRate" column="tax_rate" />
  26. </resultMap>
  27. <sql id="selectUserBillingVo">
  28. select b.id, b.user_id, b.type, b.dd_id, b.md_id,b.amount, b.divvy,b.state, b.illustrate, b.payment_method, b.account_number,b.balance_pay, b.user_type,b.cretim, b.divvy_rate, b.behalf_amount, b.wallet_balance, b.tax, b.tax_rate from user_billing b
  29. </sql>
  30. <select id="selectUserBillingList" parameterType="UserBilling" resultMap="UserBillingResult">
  31. <include refid="selectUserBillingVo"/>
  32. <if test="(userName !=null and userName!='') or (userType!=null and userType!='') ">
  33. left join info_user u on b.user_id=u.user_id
  34. </if>
  35. <where>
  36. <if test="userId != null "> and b.user_id = #{userId}</if>
  37. <if test="type != null and type != ''"> and b.type = #{type}</if>
  38. <if test="ddId != null and ddId != ''"> and b.dd_id = #{ddId}</if>
  39. <if test="state != null and state != ''"> and b.state = #{state}</if>
  40. <if test="mdId != null and mdId != ''"> and b.md_id = #{mdId}</if>
  41. <if test="paymentMethod != null and paymentMethod != ''"> and b.payment_method like concat('%', #{paymentMethod}, '%')</if>
  42. <if test="accountNumber != null and accountNumber != ''"> and b.account_number like concat('%', #{accountNumber}, '%')</if>
  43. <if test="balancePay != null and balancePay != ''"> and b.balance_pay = #{balancePay}</if>
  44. <if test="userName != null and userName != ''"> and (u.user_name like concat('%', #{userName}, '%') or u.phone like concat('%', #{userName}, '%'))</if>
  45. <if test="userType != null and userType != ''"> and u.user_type = #{userType}</if>
  46. </where>
  47. order by id desc
  48. </select>
  49. <select id="selectUserWithdrawList" parameterType="UserBilling" resultMap="UserBillingResult">
  50. <include refid="selectUserBillingVo"/>
  51. <where>
  52. type='2'
  53. <if test="userId != null "> and b.user_id = #{userId}</if>
  54. <if test="ddId != null and ddId != ''"> and b.dd_id = #{ddId}</if>
  55. <if test="state != null and state != ''"> and b.state = #{state}</if>
  56. <if test="mdId != null and mdId != ''"> and b.md_id = #{mdId}</if>
  57. <if test="paymentMethod != null and paymentMethod != ''"> and b.payment_method like concat('%', #{paymentMethod}, '%')</if>
  58. <if test="accountNumber != null and accountNumber != ''"> and b.account_number like concat('%', #{accountNumber}, '%')</if>
  59. <if test="balancePay != null and balancePay != ''"> and b.balance_pay = #{balancePay}</if>
  60. <if test="userType != null and userType != ''"> and b.user_type = #{userType}</if>
  61. </where>
  62. order by b.cretim desc
  63. </select>
  64. <select id="selectUserBillingById" parameterType="Long" resultMap="UserBillingResult">
  65. <include refid="selectUserBillingVo"/>
  66. where b.id = #{id}
  67. </select>
  68. <insert id="insertUserBilling" parameterType="UserBilling" useGeneratedKeys="true" keyProperty="id">
  69. insert into user_billing
  70. <trim prefix="(" suffix=")" suffixOverrides=",">
  71. <if test="userId != null">user_id,</if>
  72. <if test="type != null">type,</if>
  73. <if test="ddId != null">dd_id,</if>
  74. <if test="amount != null">amount,</if>
  75. <if test="state != null">state,</if>
  76. <if test="illustrate != null">illustrate,</if>
  77. <if test="paymentMethod != null">payment_method,</if>
  78. <if test="accountNumber != null">account_number,</if>
  79. <if test="mdId != null">md_id,</if>
  80. <if test="divvy != null">divvy,</if>
  81. <if test="balancePay != null">balance_pay,</if>
  82. <if test="userType != null">user_type,</if>
  83. <if test="divvyRate != null">divvy_rate,</if>
  84. <if test="behalfAmount != null">behalf_amount,</if>
  85. <if test="walletBalance != null">wallet_balance,</if>
  86. <if test="tax != null">tax,</if>
  87. <if test="taxRate != null and taxRate != ''">tax_rate,</if>
  88. </trim>
  89. <trim prefix="values (" suffix=")" suffixOverrides=",">
  90. <if test="userId != null">#{userId},</if>
  91. <if test="type != null">#{type},</if>
  92. <if test="ddId != null">#{ddId},</if>
  93. <if test="amount != null">#{amount},</if>
  94. <if test="state != null">#{state},</if>
  95. <if test="illustrate != null">#{illustrate},</if>
  96. <if test="paymentMethod != null">#{paymentMethod},</if>
  97. <if test="accountNumber != null">#{accountNumber},</if>
  98. <if test="mdId != null">#{mdId},</if>
  99. <if test="divvy != null">#{divvy},</if>
  100. <if test="balancePay != null">#{balancePay},</if>
  101. <if test="userType != null">#{userType},</if>
  102. <if test="divvyRate != null">#{divvyRate},</if>
  103. <if test="behalfAmount != null">#{behalfAmount},</if>
  104. <if test="walletBalance != null">#{walletBalance},</if>
  105. <if test="tax != null">#{tax},</if>
  106. <if test="taxRate != null and taxRate != ''">#{taxRate},</if>
  107. </trim>
  108. </insert>
  109. <update id="updateUserBilling" parameterType="UserBilling">
  110. update user_billing
  111. <trim prefix="SET" suffixOverrides=",">
  112. <if test="userId != null">user_id = #{userId},</if>
  113. <if test="type != null">type = #{type},</if>
  114. <if test="ddId != null">dd_id = #{ddId},</if>
  115. <if test="amount != null">amount = #{amount},</if>
  116. <if test="state != null">state = #{state},</if>
  117. <if test="illustrate != null">illustrate = #{illustrate},</if>
  118. <if test="paymentMethod != null">payment_method = #{paymentMethod},</if>
  119. <if test="accountNumber != null">account_number = #{accountNumber},</if>
  120. <if test="mdId != null">md_id = #{mdId},</if>
  121. <if test="divvy != null">divvy = #{divvy},</if>
  122. <if test="balancePay != null">balance_pay = #{balancePay},</if>
  123. <if test="userType != null">user_type = #{userType},</if>
  124. <if test="divvyRate != null">divvy_rate = #{divvyRate},</if>
  125. <if test="behalfAmount != null">behalf_amount = #{behalfAmount},</if>
  126. <if test="walletBalance != null">wallet_balance = #{walletBalance},</if>
  127. <if test="tax != null">tax = #{tax},</if>
  128. <if test="taxRate != null and taxRate != ''">tax_rate = #{taxRate},</if>
  129. </trim>
  130. where id = #{id}
  131. </update>
  132. <delete id="deleteUserBillingById" parameterType="Long">
  133. delete from user_billing where id = #{id}
  134. </delete>
  135. <delete id="deleteUserBillingByIds" parameterType="String">
  136. delete from user_billing where id in
  137. <foreach item="id" collection="array" open="(" separator="," close=")">
  138. #{id}
  139. </foreach>
  140. </delete>
  141. </mapper>