package com.ym.mec.web.controller;

import com.ym.mec.biz.dal.page.GroupQueryInfo;
import com.ym.mec.biz.service.CoursesGroupService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.entity.HttpResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Joburgess
 * @Date 2020/4/6
 */
@RequestMapping("coursesGroupController")
@Api(tags = "对外课程组服务")
@RestController
public class CoursesGroupController extends BaseController {

    @Autowired
    private CoursesGroupService coursesGroupService;

    @ApiOperation(value = "获取老师对外课程组")
    @GetMapping("/findTeacherCourseGroupsWithWeb")
    @PreAuthorize("@pcs.hasPermissions('coursesGroupController/findTeacherCourseGroupsWithWeb')")
    public HttpResponseResult findTeacherCourseGroupsWithWeb(GroupQueryInfo queryInfo){
        return succeed(coursesGroupService.findTeacherCourseGroupsWithWeb(queryInfo));
    }

    @ApiOperation(value = "获取学生对外课程组")
    @GetMapping("/findStudentCourseGroupsWithWeb")
    @PreAuthorize("@pcs.hasPermissions('coursesGroupController/findStudentCourseGroupsWithWeb')")
    public HttpResponseResult findStudentCourseGroupsWithWeb(GroupQueryInfo queryInfo){
        return succeed(coursesGroupService.findStudentCourseGroupsWithWeb(queryInfo));
    }

}
