UserBillingMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. </resultMap>
  20. <sql id="selectUserBillingVo">
  21. select id, user_id, type, dd_id, md_id,amount, divvy,state, illustrate, payment_method, account_number,balance_pay from user_billing
  22. </sql>
  23. <select id="selectUserBillingList" parameterType="UserBilling" resultMap="UserBillingResult">
  24. <include refid="selectUserBillingVo"/>
  25. <where>
  26. <if test="userId != null "> and user_id = #{userId}</if>
  27. <if test="type != null and type != ''"> and type = #{type}</if>
  28. <if test="ddId != null and ddId != ''"> and dd_id = #{ddId}</if>
  29. <if test="state != null and state != ''"> and state = #{state}</if>
  30. <if test="mdId != null and mdId != ''"> and md_id = #{mdId}</if>
  31. <if test="paymentMethod != null and paymentMethod != ''"> and payment_method like concat('%', #{paymentMethod}, '%')</if>
  32. <if test="accountNumber != null and accountNumber != ''"> and account_number like concat('%', #{accountNumber}, '%')</if>
  33. <if test="balancePay != null and balancePay != ''"> and balance_pay = #{balancePay}</if>
  34. </where>
  35. </select>
  36. <select id="selectUserBillingById" parameterType="Long" resultMap="UserBillingResult">
  37. <include refid="selectUserBillingVo"/>
  38. where id = #{id}
  39. </select>
  40. <insert id="insertUserBilling" parameterType="UserBilling" useGeneratedKeys="true" keyProperty="id">
  41. insert into user_billing
  42. <trim prefix="(" suffix=")" suffixOverrides=",">
  43. <if test="userId != null">user_id,</if>
  44. <if test="type != null">type,</if>
  45. <if test="ddId != null">dd_id,</if>
  46. <if test="amount != null">amount,</if>
  47. <if test="state != null">state,</if>
  48. <if test="illustrate != null">illustrate,</if>
  49. <if test="paymentMethod != null">payment_method,</if>
  50. <if test="accountNumber != null">account_number,</if>
  51. <if test="mdId != null">md_id,</if>
  52. <if test="divvy != null">divvy,</if>
  53. <if test="balancePay != null">balance_pay,</if>
  54. </trim>
  55. <trim prefix="values (" suffix=")" suffixOverrides=",">
  56. <if test="userId != null">#{userId},</if>
  57. <if test="type != null">#{type},</if>
  58. <if test="ddId != null">#{ddId},</if>
  59. <if test="amount != null">#{amount},</if>
  60. <if test="state != null">#{state},</if>
  61. <if test="illustrate != null">#{illustrate},</if>
  62. <if test="paymentMethod != null">#{paymentMethod},</if>
  63. <if test="accountNumber != null">#{accountNumber},</if>
  64. <if test="mdId != null">#{mdId},</if>
  65. <if test="divvy != null">#{divvy},</if>
  66. <if test="balancePay != null">#{balancePay},</if>
  67. </trim>
  68. </insert>
  69. <update id="updateUserBilling" parameterType="UserBilling">
  70. update user_billing
  71. <trim prefix="SET" suffixOverrides=",">
  72. <if test="userId != null">user_id = #{userId},</if>
  73. <if test="type != null">type = #{type},</if>
  74. <if test="ddId != null">dd_id = #{ddId},</if>
  75. <if test="amount != null">amount = #{amount},</if>
  76. <if test="state != null">state = #{state},</if>
  77. <if test="illustrate != null">illustrate = #{illustrate},</if>
  78. <if test="paymentMethod != null">payment_method = #{paymentMethod},</if>
  79. <if test="accountNumber != null">account_number = #{accountNumber},</if>
  80. <if test="mdId != null">md_id = #{mdId},</if>
  81. <if test="divvy != null">divvy = #{divvy},</if>
  82. <if test="balancePay != null">balance_pay = #{balancePay},</if>
  83. </trim>
  84. where id = #{id}
  85. </update>
  86. <delete id="deleteUserBillingById" parameterType="Long">
  87. delete from user_billing where id = #{id}
  88. </delete>
  89. <delete id="deleteUserBillingByIds" parameterType="String">
  90. delete from user_billing where id in
  91. <foreach item="id" collection="array" open="(" separator="," close=")">
  92. #{id}
  93. </foreach>
  94. </delete>
  95. </mapper>