CourseChapterController.java 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. package com.zhongzheng.controller.course;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import com.zhongzheng.modules.course.bo.CourseChapterAddBo;
  5. import com.zhongzheng.modules.course.bo.CourseChapterEditBo;
  6. import com.zhongzheng.modules.course.bo.CourseChapterQueryBo;
  7. import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
  8. import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
  9. import com.zhongzheng.modules.course.service.ICourseChapterBusinessService;
  10. import com.zhongzheng.modules.course.service.ICourseChapterService;
  11. import com.zhongzheng.modules.course.service.ICourseSectionBusinessService;
  12. import com.zhongzheng.modules.course.vo.CourseChapterVo;
  13. import com.zhongzheng.modules.goods.bo.GoodsBatchDelBo;
  14. import lombok.RequiredArgsConstructor;
  15. import org.springframework.security.access.prepost.PreAuthorize;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.web.bind.annotation.GetMapping;
  18. import org.springframework.web.bind.annotation.PostMapping;
  19. import org.springframework.web.bind.annotation.PutMapping;
  20. import org.springframework.web.bind.annotation.DeleteMapping;
  21. import org.springframework.web.bind.annotation.PathVariable;
  22. import org.springframework.web.bind.annotation.RequestBody;
  23. import org.springframework.web.bind.annotation.RequestMapping;
  24. import org.springframework.web.bind.annotation.RestController;
  25. import com.zhongzheng.common.annotation.Log;
  26. import com.zhongzheng.common.core.controller.BaseController;
  27. import com.zhongzheng.common.core.domain.AjaxResult;
  28. import com.zhongzheng.common.enums.BusinessType;
  29. import com.zhongzheng.common.utils.poi.ExcelUtil;
  30. import com.zhongzheng.common.core.page.TableDataInfo;
  31. import io.swagger.annotations.Api;
  32. import io.swagger.annotations.ApiOperation;
  33. /**
  34. * 课程大章Controller
  35. *
  36. * @author hjl
  37. * @date 2021-10-09
  38. */
  39. @Api(value = "课程大章控制器", tags = {"课程大章管理"})
  40. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  41. @RestController
  42. @RequestMapping("/course/chapter")
  43. public class CourseChapterController extends BaseController {
  44. private final ICourseChapterService iCourseChapterService;
  45. private final ICourseChapterBusinessService iCourseChapterBusinessService;
  46. /**
  47. * 查询课程大章列表
  48. */
  49. @ApiOperation("查询课程大章列表")
  50. @PreAuthorize("@ss.hasPermi('system:chapter:list')")
  51. @GetMapping("/list")
  52. public TableDataInfo<CourseChapterVo> list(CourseChapterQueryBo bo) {
  53. startPage();
  54. List<CourseChapterVo> list = iCourseChapterService.selectListByBo(bo);
  55. return getDataTable(list);
  56. }
  57. /**
  58. * 章批量删除
  59. */
  60. @ApiOperation("章批量删除")
  61. @PostMapping("/batch/del")
  62. public AjaxResult<Void> batchDelChapter(@RequestBody GoodsBatchDelBo bo) {
  63. return toAjax(iCourseChapterService.batchDelChapter(bo) ? 1 : 0);
  64. }
  65. /**
  66. * 导出课程大章列表
  67. */
  68. /* @ApiOperation("导出课程大章列表")
  69. @PreAuthorize("@ss.hasPermi('system:chapter:export')")
  70. @Log(title = "课程大章", businessType = BusinessType.EXPORT)
  71. @GetMapping("/export")
  72. public AjaxResult<CourseChapterVo> export(CourseChapterQueryBo bo) {
  73. List<CourseChapterVo> list = iCourseChapterService.queryList(bo);
  74. ExcelUtil<CourseChapterVo> util = new ExcelUtil<CourseChapterVo>(CourseChapterVo.class);
  75. return util.exportExcel(list, "课程大章");
  76. }*/
  77. /**
  78. * 获取课程大章详细信息
  79. */
  80. @ApiOperation("获取课程大章详细信息")
  81. @PreAuthorize("@ss.hasPermi('system:chapter:query')")
  82. @GetMapping("/{chapterId}")
  83. public AjaxResult<CourseChapterVo> getInfo(@PathVariable("chapterId" ) Long chapterId) {
  84. return AjaxResult.success(iCourseChapterService.queryById(chapterId));
  85. }
  86. /**
  87. * 新增课程大章
  88. */
  89. @ApiOperation("新增课程大章")
  90. @PreAuthorize("@ss.hasPermi('system:chapter:add')")
  91. @Log(title = "课程大章", businessType = BusinessType.INSERT)
  92. @PostMapping()
  93. public AjaxResult<Long> add(@RequestBody CourseChapterAddBo bo) {
  94. return AjaxResult.success(iCourseChapterService.insertByAddBo(bo));
  95. }
  96. /**
  97. * 新增课程大章
  98. */
  99. @ApiOperation("批量新增课程大章")
  100. @PreAuthorize("@ss.hasPermi('system:chapter:add')")
  101. @Log(title = "课程大章", businessType = BusinessType.INSERT)
  102. @PostMapping("/addMore")
  103. public AjaxResult<List<Long>> addMore(@RequestBody List<CourseChapterAddBo> list) {
  104. return AjaxResult.success(iCourseChapterService.insertByAddBoMore(list));
  105. }
  106. /**
  107. * 修改课程大章
  108. */
  109. @ApiOperation("修改课程大章")
  110. @PreAuthorize("@ss.hasPermi('system:chapter:edit')")
  111. @Log(title = "课程大章", businessType = BusinessType.UPDATE)
  112. @PostMapping("/edit")
  113. public AjaxResult<Void> edit(@RequestBody CourseChapterEditBo bo) {
  114. return toAjax(iCourseChapterService.updateByEditBo(bo) ? 1 : 0);
  115. }
  116. /**
  117. * 删除课程大章
  118. */
  119. /*@ApiOperation("删除课程大章")
  120. @PreAuthorize("@ss.hasPermi('system:chapter:remove')")
  121. @Log(title = "课程大章" , businessType = BusinessType.DELETE)
  122. @DeleteMapping("/{chapterIds}")
  123. public AjaxResult<Void> remove(@PathVariable Long[] chapterIds) {
  124. return toAjax(iCourseChapterService.deleteWithValidByIds(Arrays.asList(chapterIds), true) ? 1 : 0);
  125. }*/
  126. /**
  127. * 获取课程小节业务层次列表
  128. */
  129. @ApiOperation("获取课程大章业务层次列表")
  130. @PreAuthorize("@ss.hasPermi('system:section:query')")
  131. @GetMapping("/business/{chapterId}")
  132. public AjaxResult<List<CourseChapterBusiness>> getBusinessList(@PathVariable("chapterId" ) Long chapterId) {
  133. List<CourseChapterBusiness> list = iCourseChapterBusinessService.getListById(chapterId);
  134. return AjaxResult.success(list);
  135. }
  136. }