package cn.pluss.platform.controller;

import cn.pluss.platform.BankCardService;
import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.base.BaseModelController;
import cn.pluss.platform.entity.BankCard;
import cn.pluss.platform.entity.UserApp;
import cn.pluss.platform.userApp.UserAppService;
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;
import java.util.Map;

/**
 * <p>
 * 银行卡信息 前端控制器
 * </p>
 *
 * @author Djh
 * @since 2020-10-16
 */
@RestController
@RequestMapping("/bankCard")
public class BankCardController extends BaseModelController<BankCardService, BankCard> {

    @Autowired
    private BankCardService bankCardService;

    @Autowired
    private UserAppService uaService;

    @GetMapping("/accBankCardList")
    public Result<List<Map<String, Object>>> bankCardList() {
        UserApp userApp = uaService.queryUserAppByToken();
        List<Map<String, Object>> res = bankCardService.getAccBankCardList(userApp.getUserId() + "");
        return ResultGenerator.genSuccessResult(res);
    }
}