|
@@ -10,15 +10,16 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
-* <p>
|
|
|
-* 课程文件索引业务实现类
|
|
|
-* </p>
|
|
|
-*
|
|
|
-* @author 聪明笨狗
|
|
|
-* @since 2021-03-12 16:18
|
|
|
-*/
|
|
|
+ * <p>
|
|
|
+ * 课程文件索引业务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author 聪明笨狗
|
|
|
+ * @since 2021-03-12 16:18
|
|
|
+ */
|
|
|
@Service
|
|
|
public class CourseRefFileServiceImpl extends ServiceImpl<CourseRefFileMapper, CourseRefFile> implements CourseRefFileService {
|
|
|
|
|
@@ -29,10 +30,14 @@ public class CourseRefFileServiceImpl extends ServiceImpl<CourseRefFileMapper, C
|
|
|
wrapper.lambda().eq(CourseRefFile::getCourseId, courseId);
|
|
|
this.remove(wrapper);
|
|
|
|
|
|
- if(CollectionUtils.isEmpty(list)){
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ list = list.stream().peek(crf -> {
|
|
|
+ if (crf.getNeedLearn() == null || crf.getNeedLearn() == 0) crf.setNeedLearn(1);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
this.saveBatch(list);
|
|
|
|
|
|
}
|
|
@@ -76,10 +81,10 @@ public class CourseRefFileServiceImpl extends ServiceImpl<CourseRefFileMapper, C
|
|
|
.select(CourseRefFile::getFileId)
|
|
|
.eq(CourseRefFile::getCourseId, courseId)
|
|
|
// 下一个+1
|
|
|
- .eq(CourseRefFile::getSort, sort+1);
|
|
|
+ .eq(CourseRefFile::getSort, sort + 1);
|
|
|
|
|
|
CourseRefFile next = this.getOne(wrapper, false);
|
|
|
- if(next!=null){
|
|
|
+ if (next != null) {
|
|
|
return next.getFileId();
|
|
|
}
|
|
|
|