package com.leromro.core.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.leromro.common.core.controller.BaseController;
import com.leromro.common.core.domain.R;
import com.leromro.common.core.page.TableDataInfo;
import com.leromro.common.utils.SecurityUtils;
import com.leromro.core.domain.ClientAccount;
import com.leromro.core.service.impl.ClientAccountServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "用户账户")
@RequestMapping("/core/client/account")
public class ClientAccountController extends BaseController {
    @Autowired
    private ClientAccountServiceImpl clientAccountService;
    /**
     * 查询受服务地址列表
     * 传入传入userI
     */
    @ApiOperation("查询自己的账户余额")
    /*    @PreAuthorize("@ss.hasPermi('core:address:list')")*/
    @GetMapping("/info")
    public R<ClientAccount> clientAccountInfo(){
        Long userId = SecurityUtils.getUserId();
        ClientAccount clientAccount = clientAccountService.getOne(new LambdaQueryWrapper<ClientAccount>().eq(ClientAccount::getUserId,userId));
        return R.ok(clientAccount);
    }






}
