|
@@ -4,13 +4,16 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
-import com.zhongzheng.modules.course.bo.CourseChapterAddBo;
|
|
|
-import com.zhongzheng.modules.course.bo.CourseChapterEditBo;
|
|
|
-import com.zhongzheng.modules.course.bo.CourseChapterQueryBo;
|
|
|
+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.CourseSectionBusiness;
|
|
|
import com.zhongzheng.modules.course.mapper.CourseChapterMapper;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseChapterBusinessService;
|
|
|
import com.zhongzheng.modules.course.service.ICourseChapterService;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseSectionBusinessService;
|
|
|
import com.zhongzheng.modules.course.vo.CourseChapterVo;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -31,6 +34,9 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, CourseChapter> implements ICourseChapterService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICourseChapterBusinessService iCourseChapterBusinessService;
|
|
|
+
|
|
|
@Override
|
|
|
public CourseChapterVo queryById(Long chapterId){
|
|
|
CourseChapter db = this.baseMapper.selectById(chapterId);
|
|
@@ -77,7 +83,15 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
|
|
|
validEntityBeforeSave(add);
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
- return this.save(add);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -85,6 +99,12 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
|
|
|
CourseChapter update = BeanUtil.toBean(bo, CourseChapter.class);
|
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iCourseChapterBusinessService.remove(new LambdaQueryWrapper<CourseChapterBusiness>().eq(CourseChapterBusiness::getChapterId, bo.getChapterId()));
|
|
|
+ for(int i=0;i<bo.getBusinessList().size();i++){
|
|
|
+ CourseChapterBusinessAddBo item = bo.getBusinessList().get(i);
|
|
|
+ item.setChapterId(bo.getChapterId());
|
|
|
+ iCourseChapterBusinessService.insertByAddBo(item);
|
|
|
+ }
|
|
|
return this.updateById(update);
|
|
|
}
|
|
|
|