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.EduDeptPayType;
import com.yida.data.common.core.utils.Asserts;
import com.yida.data.system.service.EduDeptPayTypeService;
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 2022/6/22
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "支付方式配置信息(无鉴权)")
@RequestMapping("/in/deptPayType")
public class InEduDeptPayTypeController {

    private final EduDeptPayTypeService eduDeptPayTypeService;

    @ApiOperation("根据部门id查询支付方式配置")
    @GetMapping("/getPayTypeByDeptId")
    public ResultBean<EduDeptPayType> getPayTypeByDeptId(Long deptId) {
        Asserts.isNotNull(deptId, "部门不能为空");
        return ResultBean.buildSuccess(eduDeptPayTypeService.getOne(Wrappers.<EduDeptPayType>lambdaQuery()
                .eq(EduDeptPayType::getDeptId, deptId)));
    }

}
