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.consume.EduConsumeConfig;
import com.yida.data.common.core.utils.Asserts;
import com.yida.data.system.service.EduConsumeConfigService;
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/4/6
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "学校消费机服务器信息(无鉴权)")
@RequestMapping("/in/consumeConfig")
public class InConsumeConfigController {

    private final EduConsumeConfigService eduConsumeConfigService;

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

}
