package com.ym.mec.teacher.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.Objects;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ym.mec.auth.api.client.SysUserFeignService;
import com.ym.mec.auth.api.entity.SysUser;
import com.ym.mec.biz.service.TeacherDefaultVipGroupSalaryService;
import com.ym.mec.common.controller.BaseController;

/**
 * @Author Joburgess
 * @Date 2019/10/9
 */
@Api(tags = "老师默认VIP课薪酬")
@RequestMapping("teacherDefaultVipGroupSalary")
@RestController
public class TeacherDefaultVipGroupSalaryController extends BaseController {

    @Autowired
    private TeacherDefaultVipGroupSalaryService teacherDefaultVipGroupSalaryService;

    @Autowired
    private SysUserFeignService sysUserFeignService;

    @ApiOperation(value = "根据老师编号及课程类型编号获取默认课酬")
    @GetMapping("/findByTeacherAndCategory")
    public Object findByTeacherAndCategory(Integer categoryId){
        SysUser user = sysUserFeignService.queryUserInfo();
        if (Objects.isNull(user)) {
            return failed(HttpStatus.FORBIDDEN, "请登录");
        }
        return succeed(teacherDefaultVipGroupSalaryService.findByTeacherAndCategory(user.getId(),categoryId));
    }

}
