123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- 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<CourseChapterVo> list(CourseChapterQueryBo bo) {
- startPage();
- List<CourseChapterVo> list = iCourseChapterService.selectListByBo(bo);
- return getDataTable(list);
- }
- /**
- * 章批量删除
- */
- @ApiOperation("章批量删除")
- @PostMapping("/batch/del")
- public AjaxResult<Void> 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<CourseChapterVo> export(CourseChapterQueryBo bo) {
- List<CourseChapterVo> list = iCourseChapterService.queryList(bo);
- ExcelUtil<CourseChapterVo> util = new ExcelUtil<CourseChapterVo>(CourseChapterVo.class);
- return util.exportExcel(list, "课程大章");
- }*/
- /**
- * 获取课程大章详细信息
- */
- @ApiOperation("获取课程大章详细信息")
- @PreAuthorize("@ss.hasPermi('system:chapter:query')")
- @GetMapping("/{chapterId}")
- public AjaxResult<CourseChapterVo> 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<Long> 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<List<Long>> addMore(@RequestBody List<CourseChapterAddBo> list) {
- return AjaxResult.success(iCourseChapterService.insertByAddBoMore(list));
- }
- /**
- * 修改课程大章
- */
- @ApiOperation("修改课程大章")
- @PreAuthorize("@ss.hasPermi('system:chapter:edit')")
- @Log(title = "课程大章", businessType = BusinessType.UPDATE)
- @PostMapping("/edit")
- public AjaxResult<Void> 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<Void> 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<List<CourseChapterBusiness>> getBusinessList(@PathVariable("chapterId" ) Long chapterId) {
- List<CourseChapterBusiness> list = iCourseChapterBusinessService.getListById(chapterId);
- return AjaxResult.success(list);
- }
- }
|