package com.yida.data.system.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.system.EduPayWxConfig;
import com.yida.data.common.core.utils.Asserts;
import com.yida.data.system.service.EduPayWxConfigService;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;


@Api(tags = "微信支付配置信息")
@RestController
@RequestMapping("/in/payWxConfig")
@AllArgsConstructor
public class InEduPayWxConfigController {
    private final EduPayWxConfigService eduPayWxConfigService;

    @ApiOperation("根据学校查询微信支付配置")
    @GetMapping("/getPayWxConfigBySchool")
    public ResultBean<EduPayWxConfig> getPayWxConfigBySchool(Long schoolId) {
        Asserts.isNotNull(schoolId, "学校不能为空");
        return ResultBean.buildSuccess(eduPayWxConfigService.getOne(Wrappers.<EduPayWxConfig>lambdaQuery()
                .eq(EduPayWxConfig::getSchoolId, schoolId)));
    }
}
