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.UPayConfig;
import com.yida.data.common.core.utils.Asserts;
import com.yida.data.system.service.UPayConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 收钱吧支付配置信息 Controller
 *
 * @author ZYJ
 * @date 2023/3/21
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "收钱吧支付配置信息(无鉴权)")
@RequestMapping("/in/uPayConfig")
public class InUPayConfigController {

    private final UPayConfigService uPayConfigService;

    @ApiOperation("根据部门查询收钱吧支付配置信息")
    @GetMapping("/getUPayConfigByDept")
    public ResultBean<UPayConfig> getUPayConfigByDept(Long deptId) {
        Asserts.isNotNull(deptId, "部门不能为空");
        return ResultBean.buildSuccess(uPayConfigService.getOne(Wrappers.lambdaQuery(new UPayConfig())
                .eq(UPayConfig::getDeptId, deptId))
        );
    }

}
