package com.zhongzheng.controller.course; import java.util.List; import java.util.Arrays; import com.zhongzheng.modules.course.bo.CourseChapterAddBo; import com.zhongzheng.modules.course.bo.CourseChapterEditBo; import com.zhongzheng.modules.course.bo.CourseChapterQueryBo; import com.zhongzheng.modules.course.domain.CourseChapterBusiness; import com.zhongzheng.modules.course.domain.CourseSectionBusiness; import com.zhongzheng.modules.course.service.ICourseChapterBusinessService; import com.zhongzheng.modules.course.service.ICourseChapterService; import com.zhongzheng.modules.course.service.ICourseSectionBusinessService; import com.zhongzheng.modules.course.vo.CourseChapterVo; import com.zhongzheng.modules.goods.bo.GoodsBatchDelBo; 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-09 */ @Api(value = "课程大章控制器", tags = {"课程大章管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/course/chapter") public class CourseChapterController extends BaseController { private final ICourseChapterService iCourseChapterService; private final ICourseChapterBusinessService iCourseChapterBusinessService; /** * 查询课程大章列表 */ @ApiOperation("查询课程大章列表") @PreAuthorize("@ss.hasPermi('system:chapter:list')") @GetMapping("/list") public TableDataInfo list(CourseChapterQueryBo bo) { startPage(); List list = iCourseChapterService.selectListByBo(bo); return getDataTable(list); } /** * 章批量删除 */ @ApiOperation("章批量删除") @PostMapping("/batch/del") public AjaxResult batchDelChapter(@RequestBody GoodsBatchDelBo bo) { return toAjax(iCourseChapterService.batchDelChapter(bo) ? 1 : 0); } /** * 导出课程大章列表 */ /* @ApiOperation("导出课程大章列表") @PreAuthorize("@ss.hasPermi('system:chapter:export')") @Log(title = "课程大章", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(CourseChapterQueryBo bo) { List list = iCourseChapterService.queryList(bo); ExcelUtil util = new ExcelUtil(CourseChapterVo.class); return util.exportExcel(list, "课程大章"); }*/ /** * 获取课程大章详细信息 */ @ApiOperation("获取课程大章详细信息") @PreAuthorize("@ss.hasPermi('system:chapter:query')") @GetMapping("/{chapterId}") public AjaxResult getInfo(@PathVariable("chapterId" ) Long chapterId) { return AjaxResult.success(iCourseChapterService.queryById(chapterId)); } /** * 新增课程大章 */ @ApiOperation("新增课程大章") @PreAuthorize("@ss.hasPermi('system:chapter:add')") @Log(title = "课程大章", businessType = BusinessType.INSERT) @PostMapping() public AjaxResult add(@RequestBody CourseChapterAddBo bo) { return AjaxResult.success(iCourseChapterService.insertByAddBo(bo)); } /** * 新增课程大章 */ @ApiOperation("批量新增课程大章") @PreAuthorize("@ss.hasPermi('system:chapter:add')") @Log(title = "课程大章", businessType = BusinessType.INSERT) @PostMapping("/addMore") public AjaxResult> addMore(@RequestBody List list) { return AjaxResult.success(iCourseChapterService.insertByAddBoMore(list)); } /** * 修改课程大章 */ @ApiOperation("修改课程大章") @PreAuthorize("@ss.hasPermi('system:chapter:edit')") @Log(title = "课程大章", businessType = BusinessType.UPDATE) @PostMapping("/edit") public AjaxResult edit(@RequestBody CourseChapterEditBo bo) { return toAjax(iCourseChapterService.updateByEditBo(bo) ? 1 : 0); } /** * 删除课程大章 */ /*@ApiOperation("删除课程大章") @PreAuthorize("@ss.hasPermi('system:chapter:remove')") @Log(title = "课程大章" , businessType = BusinessType.DELETE) @DeleteMapping("/{chapterIds}") public AjaxResult remove(@PathVariable Long[] chapterIds) { return toAjax(iCourseChapterService.deleteWithValidByIds(Arrays.asList(chapterIds), true) ? 1 : 0); }*/ /** * 获取课程小节业务层次列表 */ @ApiOperation("获取课程大章业务层次列表") @PreAuthorize("@ss.hasPermi('system:section:query')") @GetMapping("/business/{chapterId}") public AjaxResult> getBusinessList(@PathVariable("chapterId" ) Long chapterId) { List list = iCourseChapterBusinessService.getListById(chapterId); return AjaxResult.success(list); } }