package com.zhongzheng.controller.cmmon;

import com.zhongzheng.common.core.controller.BaseController;
import com.zhongzheng.common.core.domain.AjaxResult;
import com.zhongzheng.common.core.page.TableDataInfo;
import com.zhongzheng.framework.web.service.WxTokenService;
import com.zhongzheng.modules.bank.bo.ExamQuestionQueryBo;
import com.zhongzheng.modules.bank.bo.QuestionChapterExamQueryBo;
import com.zhongzheng.modules.bank.bo.QuestionModuleChapterQueryBo;
import com.zhongzheng.modules.bank.service.IExamQuestionService;
import com.zhongzheng.modules.bank.service.IQuestionChapterExamService;
import com.zhongzheng.modules.bank.service.IQuestionModuleChapterService;
import com.zhongzheng.modules.bank.vo.ExamQuestionVo;
import com.zhongzheng.modules.bank.vo.ExamVo;
import com.zhongzheng.modules.bank.vo.QuestionChapterVo;
import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
import com.zhongzheng.modules.course.service.ICourseMenuService;
import com.zhongzheng.modules.course.service.ICourseModuleChapterService;
import com.zhongzheng.modules.course.vo.*;
import com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo;
import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 课程Controller
 *
 * @author hjl
 * @date 2021-10-09
 */
@Api(value = "游客课程访问接口", tags = {"游客程访访问接口"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/app/common/course/")
public class CommonCourseController extends BaseController {

    private final ICourseModuleChapterService iCourseModuleChapterService;
    private final ICourseMenuService iCourseMenuService;
    private final ICourseChapterSectionService iCourseChapterSectionService;



    /**
     * 查询课程目录结构列表
     */
    @ApiOperation("查询课程目录结构列表")
    @GetMapping("/menuList")
    public TableDataInfo<CourseUserMenuVo> menuList(CourseMenuQueryBo bo) {
        startPage();
        List<CourseUserMenuVo> list = iCourseMenuService.menuList(bo);
        return getDataTable(list);
    }


    @ApiOperation("查询模块与章关系列表")
    @GetMapping("/chapterList/{id}")
    public AjaxResult<List<CourseModuleChapterVo>> chapterList(@PathVariable("id" ) Long id) {
        List<CourseModuleChapterVo> list = iCourseModuleChapterService.getListById(id);
        return AjaxResult.success(list);
    }

    /**
     * 查询章与节关系列表
     */
    @ApiOperation("查询章与节关系列表+章卷同级展示")
    @GetMapping("/sectionList/{id}")
    public AjaxResult<List<CourseChapterSectionVo>> sectionList(@PathVariable("id" ) Long id) {
        List<CourseChapterSectionVo> list = iCourseChapterSectionService.getListById(id);
        return AjaxResult.success(list);
    }

}
