he2802 il y a 4 ans
Parent
commit
e3e52204e7

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

@@ -48,4 +48,6 @@ public class CourseChapterAddBo {
     /** 业务层级列表 */
     @ApiModelProperty("业务层级列表")
     private List<CourseChapterBusinessAddBo> businessList;
+    @ApiModelProperty("节id列表")
+    private List<CourseChapterSectionListAddBo> sectionIdList;
 }

+ 22 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterServiceImpl.java

@@ -7,10 +7,12 @@ import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.course.bo.*;
 import com.zhongzheng.modules.course.domain.CourseChapter;
 import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
+import com.zhongzheng.modules.course.domain.CourseChapterSection;
 import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
 import com.zhongzheng.modules.course.mapper.CourseChapterMapper;
 import com.zhongzheng.modules.course.mapper.CourseSectionMapper;
 import com.zhongzheng.modules.course.service.ICourseChapterBusinessService;
+import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
 import com.zhongzheng.modules.course.service.ICourseChapterService;
 import com.zhongzheng.modules.course.service.ICourseSectionBusinessService;
 import com.zhongzheng.modules.course.vo.CourseChapterVo;
@@ -41,6 +43,9 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
     @Autowired
     private CourseChapterMapper courseChapterMapper;
 
+    @Autowired
+    private ICourseChapterSectionService iCourseChapterSectionService;
+
     @Override
     public CourseChapterVo queryById(Long chapterId){
         CourseChapter db = this.baseMapper.selectById(chapterId);
@@ -94,11 +99,24 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
         add.setUpdateTime(DateUtils.getNowTime());
         boolean result = this.save(add);
         if(result){
-            for(int i=0;i<bo.getBusinessList().size();i++){
-                CourseChapterBusinessAddBo item = bo.getBusinessList().get(i);
-                item.setChapterId(add.getChapterId());
-                iCourseChapterBusinessService.insertByAddBo(item);
+            if(bo.getBusinessList()!=null){
+                for(int i=0;i<bo.getBusinessList().size();i++){
+                    CourseChapterBusinessAddBo item = bo.getBusinessList().get(i);
+                    item.setChapterId(add.getChapterId());
+                    iCourseChapterBusinessService.insertByAddBo(item);
+                }
+            }
+            if(bo.getSectionIdList()!=null){
+                for(int i=0;i<bo.getSectionIdList().size();i++){
+                    CourseChapterSectionListAddBo item = bo.getSectionIdList().get(i);
+                    CourseChapterSection addItem = new CourseChapterSection();
+                    addItem.setChapterId(add.getChapterId());
+                    addItem.setSectionId(item.getSectionId());
+                    addItem.setSort(item.getSort());
+                    iCourseChapterSectionService.save(addItem);
+                }
             }
+
         }
         return add.getChapterId();
     }