You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.7 KiB

  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. <mapper namespace="com.example.demo.mapper.coin.WalletMapper">
  4. <insert id="addUserWalletRecord">
  5. insert into user_wallet_record(jwcode, wallet_id, type, amount, order_code, description, status)
  6. values(#{jwcode}, #{walletId}, #{type}, #{amount}, #{orderCode}, #{description}, 1)
  7. </insert>
  8. <!-- 结果映射 -->
  9. <resultMap id="WalletResult" type="com.example.demo.domain.entity.Wallet">
  10. <id property="id" column="id"/>
  11. <result property="walletName" column="wallet_name"/>
  12. <result property="priority" column="priority"/>
  13. </resultMap>
  14. <resultMap id="UserRegionWalletResult" type="com.example.demo.domain.entity.UserRegionWallet">
  15. <id property="id" column="id"/>
  16. <result property="jwcode" column="jwcode"/>
  17. <result property="walletId" column="wallet_id"/>
  18. <result property="currentPermanentGold" column="current_permanent_gold"/>
  19. <result property="createTime" column="create_time"/>
  20. <result property="updateTime" column="update_time"/>
  21. </resultMap>
  22. <update id="updateWallet">
  23. update user_region_wallet set current_permanent_gold = #{currentPermanentGold} where jwcode = #{jwcode} and wallet_id = #{walletId}
  24. </update>
  25. <update id="updateWalletRecord">
  26. update user_wallet_record set status = 1 where id = #{id}
  27. </update>
  28. <select id="selectWallet" resultType="com.example.demo.domain.entity.UserRegionWallet">
  29. select jwcode,
  30. wallet_id,
  31. current_permanent_gold
  32. from user_region_wallet where jwcode = #{jwcode} and wallet_id = #{walletId}
  33. </select>
  34. <select id="selectWalletRecord" resultType="com.example.demo.domain.entity.UserWalletRecord">
  35. select jwcode,
  36. wallet_id,
  37. type,
  38. amount,
  39. order_code,
  40. description,
  41. status,
  42. id
  43. from user_wallet_record where jwcode = #{jwcode} and order_code = #{orderCode}
  44. </select>
  45. <select id="MysqlConnection" resultType="com.example.demo.domain.entity.GOrder">
  46. select id,
  47. jwcode,
  48. order_no,
  49. type,
  50. merchant_id,
  51. price,
  52. count,
  53. pay_style
  54. from g_order where id = #{linkId}
  55. </select>
  56. <!-- 查询所有钱包类型 -->
  57. <select id="selectAllWallets" resultMap="WalletResult">
  58. SELECT
  59. id,
  60. wallet_name,
  61. priority
  62. FROM wallet
  63. ORDER BY priority ASC
  64. </select>
  65. </mapper>