package com.zhongzheng.controller.course;

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

import com.zhongzheng.modules.course.bo.CourseModuleChapterAddBo;
import com.zhongzheng.modules.course.bo.CourseModuleChapterEditBo;
import com.zhongzheng.modules.course.bo.CourseModuleChapterQueryBo;
import com.zhongzheng.modules.course.service.ICourseModuleChapterService;
import com.zhongzheng.modules.course.vo.CourseMenuVo;
import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
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-10-11
 */
@Api(value = "模块与章关系控制器", tags = {"模块与章关系管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/course/module/chapter")
public class CourseModuleChapterController extends BaseController {

    private final ICourseModuleChapterService iCourseModuleChapterService;

    /**
     * 查询模块与章关系列表
     */
   /* @ApiOperation("查询模块与章关系列表")
    @PreAuthorize("@ss.hasPermi('system:chapter:list')")
    @GetMapping("/list")
    public TableDataInfo<CourseModuleChapterVo> list(CourseModuleChapterQueryBo bo) {
        startPage();
        List<CourseModuleChapterVo> list = iCourseModuleChapterService.queryList(bo);
        return getDataTable(list);
    }*/

    @ApiOperation("查询模块与章关系列表")
    @PreAuthorize("@ss.hasPermi('system:chapter:list')")
    @GetMapping("/allList/{id}")
    public AjaxResult<List<CourseModuleChapterVo>> all_list(@PathVariable("id" ) Long id) {
        List<CourseModuleChapterVo> list = iCourseModuleChapterService.getListById(id);
        return AjaxResult.success(list);
    }

    /**
     * 导出模块与章关系列表
     */
   /* @ApiOperation("导出模块与章关系列表")
    @PreAuthorize("@ss.hasPermi('system:chapter:export')")
    @Log(title = "模块与章关系", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult<CourseModuleChapterVo> export(CourseModuleChapterQueryBo bo) {
        List<CourseModuleChapterVo> list = iCourseModuleChapterService.queryList(bo);
        ExcelUtil<CourseModuleChapterVo> util = new ExcelUtil<CourseModuleChapterVo>(CourseModuleChapterVo.class);
        return util.exportExcel(list, "模块与章关系");
    }*/

    /**
     * 获取模块与章关系详细信息
     */
   /* @ApiOperation("获取模块与章关系详细信息")
    @PreAuthorize("@ss.hasPermi('system:chapter:query')")
    @GetMapping("/{id}")
    public AjaxResult<CourseModuleChapterVo> getInfo(@PathVariable("id" ) Long id) {
        return AjaxResult.success(iCourseModuleChapterService.queryById(id));
    }*/

    /**
     * 新增模块与章关系
     */
    /*@ApiOperation("新增模块与章关系")
    @PreAuthorize("@ss.hasPermi('system:chapter:add')")
    @Log(title = "模块与章关系", businessType = BusinessType.INSERT)
    @PostMapping()
    public AjaxResult<Void> add(@RequestBody CourseModuleChapterAddBo bo) {
        return toAjax(iCourseModuleChapterService.insertByAddBo(bo) ? 1 : 0);
    }*/

    /**
     * 修改模块与章关系
     */
   /* @ApiOperation("修改模块与章关系")
    @PreAuthorize("@ss.hasPermi('system:chapter:edit')")
    @Log(title = "模块与章关系", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult<Void> edit(@RequestBody CourseModuleChapterEditBo bo) {
        return toAjax(iCourseModuleChapterService.updateByEditBo(bo) ? 1 : 0);
    }*/

    /**
     * 删除模块与章关系
     */
   /* @ApiOperation("删除模块与章关系")
    @PreAuthorize("@ss.hasPermi('system:chapter:remove')")
    @Log(title = "模块与章关系" , businessType = BusinessType.DELETE)
    @PostMapping("/del/{ids}")
    public AjaxResult<Void> remove(@PathVariable Long[] ids) {
        return toAjax(iCourseModuleChapterService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
    }*/
}
