| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.model.AppUserBank; |
| | | import com.ruoyi.account.service.AppUserBankService; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | |
| | | @ApiOperation(value = "保存银行卡") |
| | | public AjaxResult saveAppUserBank(@RequestBody AppUserBank appUserBank){ |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | appUserBank.setAppUserId(loginUserApplet.getUserid()); |
| | | appUserBankService.saveOrUpdate(appUserBank); |
| | | |
| | | AppUserBank bank = appUserBankService.getOne(new LambdaQueryWrapper<AppUserBank>() |
| | | .eq(AppUserBank::getAppUserId, loginUserApplet.getUserid())); |
| | | if (bank == null){ |
| | | appUserBank.setAppUserId(loginUserApplet.getUserid()); |
| | | appUserBankService.saveOrUpdate(appUserBank); |
| | | }else { |
| | | appUserBank.setId(bank.getId()); |
| | | appUserBankService.updateById(appUserBank); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "获取银行卡信息") |
| | | public AjaxResult<AppUserBank> getAppUserBank(){ |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUserBank bank = appUserBankService.getById(loginUserApplet.getUserid()); |
| | | return AjaxResult.success(bank); |
| | | AppUserBank appUserBank = appUserBankService.getOne(new LambdaQueryWrapper<AppUserBank>() |
| | | .eq(AppUserBank::getAppUserId, loginUserApplet.getUserid())); |
| | | return AjaxResult.success(appUserBank); |
| | | } |
| | | |
| | | } |