package com.zhongzheng.controller.course;

import com.zhongzheng.common.annotation.Log;
import com.zhongzheng.common.core.controller.BaseController;
import com.zhongzheng.common.core.domain.AjaxResult;
import com.zhongzheng.common.core.page.TableDataInfo;
import com.zhongzheng.common.enums.BusinessType;
import com.zhongzheng.modules.course.bo.CourseHandoutsAddBo;
import com.zhongzheng.modules.course.bo.CourseHandoutsEditBo;
import com.zhongzheng.modules.course.bo.CourseHandoutsQueryBo;
import com.zhongzheng.modules.course.service.ICourseHandoutsService;
import com.zhongzheng.modules.course.vo.CourseHandoutsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 讲义列Controller
 * 
 * @author ruoyi
 * @date 2021-11-02
 */
@Api(value = "讲义列控制器", tags = {"讲义列管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/course/handouts")
public class CourseHandoutsController extends BaseController {

    private final ICourseHandoutsService iCourseHandoutsService;

    /**
     * 查询讲义列列表
     */
    @ApiOperation("查询讲义列列表")
    @GetMapping("/list")
    public TableDataInfo<CourseHandoutsVo> list(CourseHandoutsQueryBo bo) {
        startPage();
        List<CourseHandoutsVo> list = iCourseHandoutsService.queryList(bo);
        return getDataTable(list);
    }



    /**
     * 获取讲义列详细信息
     */
    @ApiOperation("获取讲义列详细信息")
    @GetMapping("/{handoutsId}")
    public AjaxResult<CourseHandoutsVo> getInfo(@PathVariable("handoutsId" ) Long handoutsId) {
        return AjaxResult.success(iCourseHandoutsService.queryById(handoutsId));
    }
}
