package com.yonge.cooleshow.website.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
import com.yonge.cooleshow.auth.api.entity.SysUser;
import com.yonge.cooleshow.biz.dal.dto.TeacherDto;
import com.yonge.cooleshow.biz.dal.entity.Subject;
import com.yonge.cooleshow.biz.dal.service.TeacherService;
import com.yonge.toolset.mybatis.support.PageUtil;
import com.yonge.cooleshow.biz.dal.vo.MyFens;
import com.yonge.cooleshow.biz.dal.vo.TeacherHomeVo;
import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
import com.yonge.cooleshow.common.controller.BaseController;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import com.yonge.toolset.base.page.PageInfo;
import com.yonge.toolset.base.page.QueryInfo;
import com.yonge.toolset.base.util.StringUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/website")
@Api(value = "官网", tags = "官网")
public class WebSiteController extends BaseController {
    @Autowired
    private SysUserFeignService sysUserFeignService;

    @ApiOperation(value = "切换用户类型")
    @GetMapping("/cutUserType")
    public HttpResponseResult<String> cutUserType(
            @ApiParam(value = "userType", required = true) @RequestParam("userType") String userType) {
        SysUser user = sysUserFeignService.queryUserInfo();
        if (user == null || null == user.getId()) {
            return HttpResponseResult.failed(HttpStatus.FORBIDDEN, "请登录");
        }
        if(user.getUserType().contains(userType)){
            return HttpResponseResult.succeed(userType);
        }else{
            return HttpResponseResult.failed("没有该用户类型");
        }
    }

}