UserWalletMapper.xml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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.UserWalletMapper">
  6. <resultMap type="UserWallet" id="UserWalletResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="userId" />
  9. <result property="pointsWallet" column="points_wallet" />
  10. <result property="version" column="version" />
  11. </resultMap>
  12. <sql id="selectUserWalletVo">
  13. select id, userId, points_wallet,version from user_wallet
  14. </sql>
  15. <select id="selectUserWalletList" parameterType="UserWallet" resultMap="UserWalletResult">
  16. <include refid="selectUserWalletVo"/>
  17. <where>
  18. <if test="pointsWallet != null "> and points_wallet = #{pointsWallet}</if>
  19. </where>
  20. </select>
  21. <select id="selectUserWalletById" parameterType="Long" resultMap="UserWalletResult">
  22. <include refid="selectUserWalletVo"/>
  23. where id = #{id}
  24. </select>
  25. <insert id="insertUserWallet" parameterType="UserWallet" useGeneratedKeys="true" keyProperty="id">
  26. insert into user_wallet
  27. <trim prefix="(" suffix=")" suffixOverrides=",">
  28. <if test="userId != null">userId,</if>
  29. <if test="pointsWallet != null">points_wallet,</if>
  30. <if test="version != null">version,</if>
  31. </trim>
  32. <trim prefix="values (" suffix=")" suffixOverrides=",">
  33. <if test="userId != null">#{userId},</if>
  34. <if test="pointsWallet != null">#{pointsWallet},</if>
  35. <if test="version != null">#{version},</if>
  36. </trim>
  37. </insert>
  38. <update id="updateUserWallet" parameterType="UserWallet">
  39. update user_wallet
  40. <trim prefix="SET" suffixOverrides=",">
  41. <if test="userId != null">userId = #{userId},</if>
  42. <if test="pointsWallet != null">points_wallet = #{pointsWallet},</if>
  43. <if test="version != null">version = #{version},</if>
  44. </trim>
  45. where id = #{id}
  46. </update>
  47. <delete id="deleteUserWalletById" parameterType="Long">
  48. delete from user_wallet where id = #{id}
  49. </delete>
  50. <delete id="deleteUserWalletByIds" parameterType="String">
  51. delete from user_wallet where id in
  52. <foreach item="id" collection="array" open="(" separator="," close=")">
  53. #{id}
  54. </foreach>
  55. </delete>
  56. </mapper>