package com.cool.store.controller.webc;

import com.cool.store.entity.BankdocDO;
import com.cool.store.entity.BanktypeDO;
import com.cool.store.request.BranchBankPageRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.BankService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Fun Li 2023/8/10 14:20
 * @version 1.0
 */
@RestController
@RequestMapping("/mini/bank")
@Api(tags = "银行信息")
@Slf4j
public class BankController {

    @Autowired
    private BankService bankService;

    @ApiOperation("银行类型")
    @GetMapping("/listBank")
    public ResponseResult<List<BanktypeDO>> listBank() {
        List<BanktypeDO> result = bankService.listBank();
        return ResponseResult.success(result);
    }

    @ApiOperation("支行列表查询")
    @PostMapping("/listBranchBank")
    public ResponseResult<PageInfo<BankdocDO>> listBranchBank(@RequestBody @Validated BranchBankPageRequest request) {
        return ResponseResult.success(bankService.listBranchBank(request));
    }

}
