package com.zhongzheng.controller.course;

import java.util.List;
import java.util.Arrays;

import com.zhongzheng.modules.course.bo.CourseMenuExamAddBo;
import com.zhongzheng.modules.course.bo.CourseMenuExamEditBo;
import com.zhongzheng.modules.course.bo.CourseMenuExamQueryBo;
import com.zhongzheng.modules.course.service.ICourseMenuExamService;
import com.zhongzheng.modules.course.vo.CourseMenuExamVo;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhongzheng.common.annotation.Log;
import com.zhongzheng.common.core.controller.BaseController;
import com.zhongzheng.common.core.domain.AjaxResult;
import com.zhongzheng.common.enums.BusinessType;
import com.zhongzheng.common.utils.poi.ExcelUtil;
import com.zhongzheng.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 课程目录关联卷Controller
 *
 * @author hjl
 * @date 2021-11-17
 */
@Api(value = "课程目录关联卷控制器", tags = {"课程目录关联卷管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/course/menu/exam")
public class CourseMenuExamController extends BaseController {

    private final ICourseMenuExamService iCourseMenuExamService;

    /**
     * 查询课程目录关联卷列表
     */
    @ApiOperation("查询课程目录关联卷列表")
    @PreAuthorize("@ss.hasPermi('system:exam:list')")
    @GetMapping("/list")
    public TableDataInfo<CourseMenuExamVo> list(CourseMenuExamQueryBo bo) {
        startPage();
        List<CourseMenuExamVo> list = iCourseMenuExamService.getList(bo);
        return getDataTable(list);
    }

    /**
     * 导出课程目录关联卷列表
     */
   /* @ApiOperation("导出课程目录关联卷列表")
    @PreAuthorize("@ss.hasPermi('system:exam:export')")
    @Log(title = "课程目录关联卷", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult<CourseMenuExamVo> export(CourseMenuExamQueryBo bo) {
        List<CourseMenuExamVo> list = iCourseMenuExamService.queryList(bo);
        ExcelUtil<CourseMenuExamVo> util = new ExcelUtil<CourseMenuExamVo>(CourseMenuExamVo.class);
        return util.exportExcel(list, "课程目录关联卷");
    }*/

    /**
     * 获取课程目录关联卷详细信息
     */
 /*   @ApiOperation("获取课程目录关联卷详细信息")
    @PreAuthorize("@ss.hasPermi('system:exam:query')")
    @GetMapping("/{id}")
    public AjaxResult<CourseMenuExamVo> getInfo(@PathVariable("id" ) Long id) {
        return AjaxResult.success(iCourseMenuExamService.queryById(id));
    }*/

    /**
     * 新增课程目录关联卷
     */
   /* @ApiOperation("新增课程目录关联卷")
    @PreAuthorize("@ss.hasPermi('system:exam:add')")
    @Log(title = "课程目录关联卷", businessType = BusinessType.INSERT)
    @PostMapping()
    public AjaxResult<Void> add(@RequestBody CourseMenuExamAddBo bo) {
        return toAjax(iCourseMenuExamService.insertByAddBo(bo) ? 1 : 0);
    }*/

    /**
     * 修改课程目录关联卷
     */
   /* @ApiOperation("修改课程目录关联卷")
    @PreAuthorize("@ss.hasPermi('system:exam:edit')")
    @Log(title = "课程目录关联卷", businessType = BusinessType.UPDATE)
    @PutMapping()
    public AjaxResult<Void> edit(@RequestBody CourseMenuExamEditBo bo) {
        return toAjax(iCourseMenuExamService.updateByEditBo(bo) ? 1 : 0);
    }*/

    /**
     * 删除课程目录关联卷
     */
   /* @ApiOperation("删除课程目录关联卷")
    @PreAuthorize("@ss.hasPermi('system:exam:remove')")
    @Log(title = "课程目录关联卷" , businessType = BusinessType.DELETE)
    @PostMapping("/delete/{ids}")
    public AjaxResult<Void> remove(@PathVariable Long[] ids) {
        return toAjax(iCourseMenuExamService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
    }*/
}
