package com.yida.data.school.secondClass.controller;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.school.secondClass.EduSecondClassConfig;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.school.secondClass.service.EduSecondClassConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "第二课堂-tab配置")
@Slf4j
@RestController
@RequestMapping("/secondClass/config")
@RequiredArgsConstructor
public class EduSecondClassConfigController {

    private final EduSecondClassConfigService eduSecondClassConfigService;

    @ApiOperation("查询tab列表")
    @GetMapping("/getConfig")
    public ResultBean<EduSecondClassConfig> getConfig() {
        Long deptId = FebsUtil.getTopDeptId();
        return ResultBean.buildSuccess(eduSecondClassConfigService.getConfig(deptId));
    }

    @ApiOperation("修改tab显示状态")
    @GetMapping("/updateConfigShow")
    public ResultBean updateConfigShow(@ApiParam("0-主页，1-场馆,2-智慧平台，3-名师在线") Integer type, @ApiParam("0-显示，1-不显示") Integer show) {
        eduSecondClassConfigService.updateConfig(FebsUtil.getTopDeptId(), show, type);
        return ResultBean.buildSuccess();
    }
}
