WalletTransactionMapper.xml 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.WalletTransactionMapper">
  6. <resultMap type="WalletTransaction" id="PointsTransactionResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="ddId" column="dd_id" />
  10. <result property="type" column="type" />
  11. <result property="createTime" column="create_time" />
  12. <result property="updateTime" column="update_time" />
  13. <result property="remark" column="remark" />
  14. <result property="change" column="change" />
  15. <result property="currentBalance" column="current_balance" />
  16. </resultMap>
  17. <sql id="selectPointsTransactionVo">
  18. select id, user_id, dd_id, type, create_time, update_time, remark, change, current_balance from wallet_transaction
  19. </sql>
  20. <select id="selectPointsTransactionList" parameterType="WalletTransaction" resultMap="PointsTransactionResult">
  21. <include refid="selectPointsTransactionVo"/>
  22. <where>
  23. <if test="userId != null "> and user_id = #{userId}</if>
  24. <if test="ddId != null "> and dd_id = #{ddId}</if>
  25. <if test="type != null and type != ''"> and type = #{type}</if>
  26. <if test="change != null and change != ''"> and change = #{change}</if>
  27. <if test="currentBalance != null and currentBalance != ''"> and current_balance = #{currentBalance}</if>
  28. </where>
  29. </select>
  30. <select id="selectPointsTransactionById" parameterType="Long" resultMap="PointsTransactionResult">
  31. <include refid="selectPointsTransactionVo"/>
  32. where id = #{id}
  33. </select>
  34. <insert id="insertPointsTransaction" parameterType="WalletTransaction" useGeneratedKeys="true" keyProperty="id">
  35. insert into wallet_transaction
  36. <trim prefix="(" suffix=")" suffixOverrides=",">
  37. <if test="userId != null">user_id,</if>
  38. <if test="ddId != null">dd_id,</if>
  39. <if test="type != null and type != ''">type,</if>
  40. <if test="createTime != null">create_time,</if>
  41. <if test="updateTime != null">update_time,</if>
  42. <if test="remark != null">remark,</if>
  43. <if test="change != null and change != ''">change,</if>
  44. <if test="currentBalance != null and currentBalance != ''">current_balance,</if>
  45. </trim>
  46. <trim prefix="values (" suffix=")" suffixOverrides=",">
  47. <if test="userId != null">#{userId},</if>
  48. <if test="ddId != null">#{ddId},</if>
  49. <if test="type != null and type != ''">#{type},</if>
  50. <if test="createTime != null">#{createTime},</if>
  51. <if test="updateTime != null">#{updateTime},</if>
  52. <if test="remark != null">#{remark},</if>
  53. <if test="change != null and change != ''">#{change},</if>
  54. <if test="currentBalance != null and currentBalance != ''">#{currentBalance},</if>
  55. </trim>
  56. </insert>
  57. <update id="updatePointsTransaction" parameterType="WalletTransaction">
  58. update wallet_transaction
  59. <trim prefix="SET" suffixOverrides=",">
  60. <if test="userId != null">user_id = #{userId},</if>
  61. <if test="ddId != null">dd_id = #{ddId},</if>
  62. <if test="type != null and type != ''">type = #{type},</if>
  63. <if test="createTime != null">create_time = #{createTime},</if>
  64. <if test="updateTime != null">update_time = #{updateTime},</if>
  65. <if test="remark != null">remark = #{remark},</if>
  66. <if test="change != null and change != ''">change = #{change},</if>
  67. <if test="currentBalance != null and currentBalance != ''">current_balance = #{currentBalance},</if>
  68. </trim>
  69. where id = #{id}
  70. </update>
  71. <delete id="deletePointsTransactionById" parameterType="Long">
  72. delete from wallet_transaction where id = #{id}
  73. </delete>
  74. <delete id="deletePointsTransactionByIds" parameterType="String">
  75. delete from wallet_transaction where id in
  76. <foreach item="id" collection="array" open="(" separator="," close=")">
  77. #{id}
  78. </foreach>
  79. </delete>
  80. </mapper>