package com.ym.mec.web.controller;

import com.ym.mec.auth.api.client.SysUserFeignService;
import com.ym.mec.auth.api.entity.SysUser;
import com.ym.mec.biz.service.SysUserCashAccountService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.page.QueryInfo;
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;

@RequestMapping("userCashAccount")
@Api(tags = "用户账户服务")
@RestController
public class SysUserCashAccountController extends BaseController {

    @Autowired
    private SysUserCashAccountService sysUserCashAccountService;
    @Autowired
    private SysUserFeignService sysUserFeignService;

    @ApiOperation(value = "获取用户账户信息")
    @GetMapping("/get")
    public Object add() {
        SysUser sysUser = sysUserFeignService.queryUserInfo();
        if(sysUser == null){
            return failed("请重新登录");
        }
        return succeed(sysUserCashAccountService.get(sysUser.getId()));
    }

    @ApiOperation(value = "分页查询收费类型列表")
    @GetMapping("/queryPage")
    public Object queryPage(QueryInfo queryInfo) {
        return succeed(sysUserCashAccountService.queryPage(queryInfo));
    }

}
