Browse Source

流业务层

he2802 4 years ago
parent
commit
dda2d38702

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseChapterEditBo.java

@@ -59,5 +59,7 @@ public class CourseChapterEditBo {
     /** 业务层级列表 */
     @ApiModelProperty("业务层级列表")
     private List<CourseChapterBusinessAddBo> businessList;
+    @ApiModelProperty("节id列表")
+    private List<CourseChapterSectionListAddBo> sectionIdList;
 
 }

+ 18 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterServiceImpl.java

@@ -48,6 +48,9 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
     @Autowired
     private ICourseChapterSectionService iCourseChapterSectionService;
 
+    @Autowired
+    private ICourseChapterSectionService iCourseChapterSectionService;
+
     @Override
     public CourseChapterVo queryById(Long chapterId){
         CourseChapter db = this.baseMapper.selectById(chapterId);
@@ -127,6 +130,7 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean updateByEditBo(CourseChapterEditBo bo) {
         CourseChapter update = BeanUtil.toBean(bo, CourseChapter.class);
         validEntityBeforeSave(update);
@@ -139,6 +143,20 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
                 iCourseChapterBusinessService.insertByAddBo(item);
             }
         }
+        if(bo.getSectionIdList()!=null){
+            iCourseChapterSectionService.remove(new LambdaQueryWrapper<CourseChapterSection>().eq(CourseChapterSection::getChapterId, bo.getChapterId()));
+            Collection<CourseChapterSection> coll = new HashSet<>();
+            for(int i=0;i<bo.getSectionIdList().size();i++){
+                Long sectionId = bo.getSectionIdList().get(i).getSectionId();
+                Long sort = bo.getSectionIdList().get(i).getSort();
+                CourseChapterSection add = new CourseChapterSection();
+                add.setChapterId(bo.getChapterId());
+                add.setSectionId(sectionId);
+                add.setSort(sort);
+                coll.add(add);
+            }
+            iCourseChapterSectionService.saveBatch(coll);
+        }
 
         return this.updateById(update);
     }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseStreamingServiceImpl.java

@@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.Page;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -109,6 +110,7 @@ public class CourseStreamingServiceImpl extends ServiceImpl<CourseStreamingMappe
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean updateByEditBo(CourseStreamingEditBo bo) {
         CourseStreaming update = BeanUtil.toBean(bo, CourseStreaming.class);
         validEntityBeforeSave(update);