package com.hzs.system.config.controller.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hzs.common.core.enums.EYesNo;
import com.hzs.common.core.web.controller.BaseController;
import com.hzs.common.core.web.domain.AjaxResult;
import com.hzs.common.domain.system.config.BdBank;
import com.hzs.common.security.utils.SecurityUtils;
import com.hzs.system.config.service.IBdBankService;
import lombok.extern.slf4j.Slf4j;
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;

/**
 * @Description:
 * @Author: yuhui
 * @Time: 2022/10/25 15:38
 * @Classname: BdBankController
 * @PackageName: com.hzs.system.config.controller.api
 */
@Slf4j
@RestController("apiBankController")
@RequestMapping("/api/bank")
public class ApiBankController extends BaseController {

    @Autowired
    private IBdBankService bankService;

    /**
     * 查询银行卡列表
     * @return
     */
    @GetMapping("list")
    public AjaxResult list(Integer pkCountry){
        if (null == pkCountry) {
            pkCountry = SecurityUtils.getPkCountry();
        }
        QueryWrapper<BdBank> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("PK_COUNTRY", pkCountry);
        queryWrapper.eq("ENABLE_STATE", EYesNo.YES.getIntValue());
        List<BdBank> list = bankService.list(queryWrapper);
        return AjaxResult.success(list);
    }


}
