|
@@ -0,0 +1,91 @@
|
|
|
+package com.ym.mec.web.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.dayaedu.cbs.openfeign.client.CoursewareFeignService;
|
|
|
+import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareWrapper;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.microsvc.toolkit.common.response.paging.QueryInfo;
|
|
|
+import com.ym.mec.biz.dal.entity.LessonCourseware;
|
|
|
+import com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper;
|
|
|
+import com.ym.mec.biz.dal.wrapper.SchoolActivityWrapper;
|
|
|
+import com.ym.mec.biz.service.LessonCoursewareService;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+import com.ym.mec.common.page.PageInfo;
|
|
|
+import com.ym.mec.common.page.PageUtil;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RequestMapping("${app-config.url.web:}/lessonCourseware")
|
|
|
+@Api(tags = "课件教材")
|
|
|
+@RestController
|
|
|
+public class LessonCoursewareController extends BaseController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private CoursewareFeignService coursewareFeignService;
|
|
|
+ @Resource
|
|
|
+ private LessonCoursewareService lessonCoursewareService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取内容平台课件教材")
|
|
|
+ @PostMapping("/queryPage")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('lessonCourseware/queryPage')")
|
|
|
+ public HttpResponseResult<PageInfo<CbsLessonCoursewareWrapper.LessonCourseware>> queryPage(@RequestBody CbsLessonCoursewareWrapper.LessonCoursewareQuery query) throws Exception {
|
|
|
+ return succeed(PageUtil.pageInfo(coursewareFeignService.lessonCoursewarePage(query).feignData()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取已添加的课件id列表")
|
|
|
+ @PostMapping("/queryLessonCoursewareId")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('lessonCourseware/queryLessonCoursewareId')")
|
|
|
+ public HttpResponseResult<List<Long>> queryLessonCoursewareId(){
|
|
|
+ List<LessonCourseware> list = lessonCoursewareService.lambdaQuery().list();
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
+ return succeed(Lists.newArrayList());
|
|
|
+ }
|
|
|
+ List<Long> ids = list.stream().map(LessonCourseware::getLessonCourseId).collect(java.util.stream.Collectors.toList());
|
|
|
+ return succeed(ids);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "批量删除已添加的课件")
|
|
|
+ @PostMapping("/deleteLessonCourseware")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('lessonCourseware/deleteLessonCourseware')")
|
|
|
+ public HttpResponseResult<Boolean> deleteLessonCourseware(@RequestBody List<Long> ids){
|
|
|
+ if (CollectionUtils.isEmpty(ids)) {
|
|
|
+ return succeed(false);
|
|
|
+ }
|
|
|
+ return succeed(lessonCoursewareService.removeByIds(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "分页查询已添加的课件")
|
|
|
+ @PostMapping("/queryLessonCourseware")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('lessonCourseware/queryLessonCourseware')")
|
|
|
+ public HttpResponseResult<PageInfo<LessonCoursewareWrapper.LessonCoursewareDto>> queryLessonCourseware(@RequestBody LessonCoursewareWrapper.LessonCoursewareQuery query){
|
|
|
+ IPage<LessonCoursewareWrapper.LessonCoursewareDto> pages = lessonCoursewareService.selectPage(QueryInfo.getPage(query), query);
|
|
|
+ return succeed(PageUtil.pageInfo(pages));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "启用、停用课件")
|
|
|
+ @GetMapping("/updateEnableFlag")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('lessonCourseware/updateEnableFlag')")
|
|
|
+ public HttpResponseResult updateEnableFlag(Integer id,Boolean enableFlag){
|
|
|
+ lessonCoursewareService.lambdaUpdate().set(LessonCourseware::getEnable, enableFlag)
|
|
|
+ .eq(LessonCourseware::getId, id)
|
|
|
+ .update();
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改课件声部")
|
|
|
+ @GetMapping("/updateSubject")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('lessonCourseware/updateSubject')")
|
|
|
+ public HttpResponseResult updateSubject(Integer id,Integer subjectId){
|
|
|
+ lessonCoursewareService.lambdaUpdate().set(LessonCourseware::getSubjectId, subjectId)
|
|
|
+ .eq(LessonCourseware::getId, id)
|
|
|
+ .update();
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+}
|