Procházet zdrojové kódy

公开课项目名称展示

chenguo před 1 dnem
rodič
revize
ba65da68e1

+ 11 - 4
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -2181,10 +2181,17 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         List<FsUserCourseVideoPageListVO> vos = fsUserCourseVideoMapper.selectFsUserCourseVideoListByMap(params);
         // 项目
         List<SysDictData> courseProject = dictDataMapper.selectDictDataByType("sys_course_project");
-        vos.forEach(vo -> courseProject.stream()
-                .filter(c -> c.getDictValue().equals(vo.getProjectId().toString()))
-                .findFirst()
-                .ifPresent(c -> vo.setProjectName(c.getDictLabel())));
+        Map<String, String> projectMap = courseProject.stream()
+                .collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
+        vos.forEach(vo -> {
+            if (vo.getProjectId() != null) {
+                String projectName = projectMap.get(vo.getProjectId().toString());
+                if (projectName != null) {
+                    vo.setProjectName(projectName);
+                }
+            }
+        });
+
         return vos;
     }
     /**