|
@@ -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);
|
|
|
}
|