课程详情增加部门名称对象

This commit is contained in:
wsw 2024-06-02 11:51:25 +08:00
parent 5d1a6109c2
commit 4d527cff77

View File

@ -346,6 +346,14 @@ public class CourseController {
});
}
// 部门名称
Map<Integer, String> deps = new HashMap<>();
if (StringUtil.isNotEmpty(depIds)) {
deps =
departmentService.chunk(depIds).stream()
.collect(Collectors.toMap(Department::getId, Department::getName));
}
HashMap<String, Object> data = new HashMap<>();
data.put("course", course);
data.put("dep_ids", depIds); // 已关联的部门
@ -353,6 +361,7 @@ public class CourseController {
data.put("chapters", chapters);
data.put("hours", hours.stream().collect(Collectors.groupingBy(CourseHour::getChapterId)));
data.put("attachments", attachments);
data.put("deps", deps);
return JsonResponse.data(data);
}