package com.czg.controller.admin;

import com.czg.BaseQueryParam;
import com.czg.resp.CzgResult;
import com.czg.system.entity.SysBankInfo;
import com.czg.system.entity.SysRegion;
import com.czg.system.service.SysBankInfoService;
import com.czg.system.service.SysCategoryInfoService;
import com.czg.system.service.SysRegionService;
import com.czg.system.vo.SysCategoryInfoVO;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 通用
 *
 * @author Administrator
 */
@RestController
@RequestMapping("/admin/common")
public class SysCommonController {
    @Resource
    private SysRegionService sysRegionService;
    @Resource
    private SysBankInfoService bankInfoService;
    @Resource
    private SysCategoryInfoService categoryInfoService;

    /**
     * 获取所有地域
     */
    @GetMapping("/region")
    public CzgResult<List<SysRegion>> region() {
        return CzgResult.success(sysRegionService.regionList());
    }

    /**
     * 获取银行信息
     */
    @GetMapping("/bankInfo")
    public CzgResult<Page<SysBankInfo>> bankInfo(BaseQueryParam param, @RequestParam String bankName) {
        return CzgResult.success(bankInfoService.bankInfoList(param, bankName));
    }


    /**
     * 类目信息表
     */
    @GetMapping("/category")
    public CzgResult<List<SysCategoryInfoVO>> category() {
        return CzgResult.success(categoryInfoService.categoryList());
    }
}
