UserWalletServiceImpl.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package com.ruoyi.system.service.impl;
  2. import java.math.BigDecimal;
  3. import java.util.List;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.stereotype.Service;
  6. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  7. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  8. import com.ruoyi.system.mapper.UserWalletMapper;
  9. import com.ruoyi.system.domain.UserWallet;
  10. import com.ruoyi.system.service.IUserWalletService;
  11. /**
  12. * 用户钱包 Service业务层处理
  13. *
  14. * @author ruoyi
  15. * @date 2025-05-29
  16. */
  17. @Service
  18. public class UserWalletServiceImpl extends ServiceImpl<BaseMapper<UserWallet>,UserWallet> implements IUserWalletService
  19. {
  20. @Autowired
  21. private UserWalletMapper userWalletMapper;
  22. /**
  23. * 查询【请填写功能名称】
  24. *
  25. * @param id 【请填写功能名称】主键
  26. * @return 【请填写功能名称】
  27. */
  28. @Override
  29. public UserWallet selectUserWalletById(Long id)
  30. {
  31. return userWalletMapper.selectUserWalletById(id);
  32. }
  33. /**
  34. * 查询【请填写功能名称】列表
  35. *
  36. * @param userWallet 【请填写功能名称】
  37. * @return 【请填写功能名称】
  38. */
  39. @Override
  40. public List<UserWallet> selectUserWalletList(UserWallet userWallet)
  41. {
  42. return userWalletMapper.selectUserWalletList(userWallet);
  43. }
  44. /**
  45. * 新增【请填写功能名称】
  46. *
  47. * @param userWallet 【请填写功能名称】
  48. * @return 结果
  49. */
  50. @Override
  51. public int insertUserWallet(UserWallet userWallet)
  52. {
  53. return userWalletMapper.insertUserWallet(userWallet);
  54. }
  55. /**
  56. * 创建用户时创建钱包
  57. *
  58. * @param userId
  59. */
  60. @Override
  61. public void createUserWallet(Long userId)
  62. {
  63. UserWallet userWallet = new UserWallet();
  64. userWallet.setUserId(userId);
  65. userWallet.setPointsWallet(0L);
  66. userWallet.setBalanceWallet(BigDecimal.ZERO);
  67. // userWallet.setBlockedFunds(BigDecimal.ZERO);
  68. userWalletMapper.insertUserWallet(userWallet);
  69. }
  70. /**
  71. * 修改【请填写功能名称】
  72. *
  73. * @param userWallet 【请填写功能名称】
  74. * @return 结果
  75. */
  76. @Override
  77. public int updateUserWallet(UserWallet userWallet)
  78. {
  79. return userWalletMapper.updateUserWallet(userWallet);
  80. }
  81. /**
  82. * 批量删除【请填写功能名称】
  83. *
  84. * @param ids 需要删除的【请填写功能名称】主键
  85. * @return 结果
  86. */
  87. @Override
  88. public int deleteUserWalletByIds(Long[] ids)
  89. {
  90. return userWalletMapper.deleteUserWalletByIds(ids);
  91. }
  92. /**
  93. * 删除【请填写功能名称】信息
  94. *
  95. * @param id 【请填写功能名称】主键
  96. * @return 结果
  97. */
  98. @Override
  99. public int deleteUserWalletById(Long id)
  100. {
  101. return userWalletMapper.deleteUserWalletById(id);
  102. }
  103. }