fix:保存主题统一

This commit is contained in:
zhonghua 2026-03-23 16:26:10 +08:00
parent 1d23f617d5
commit c6328dd441
5 changed files with 21 additions and 0 deletions

View File

@ -48,6 +48,7 @@ export interface Course {
// 新增字段
themeId?: number;
theme?: { id: number; name: string };
themeName?: string;
coreContent?: string;
coverImagePath?: string;
domainTags?: string[];

View File

@ -62,6 +62,8 @@ export interface CourseResponse {
environmentConstruction?: string;
/** 主题 ID */
themeId?: number;
/** 主题名称 */
themeName?: string;
/** 绘本名称 */
pictureBookName?: string;
/** 封面图片路径 */

View File

@ -53,6 +53,10 @@
</div>
</template>
<template v-else-if="column.key === 'theme'">
<span>{{ record.themeName || record.theme?.name || '-' }}</span>
</template>
<template v-else-if="column.key === 'pictureBook'">
{{ record.pictureBookName }}
</template>
@ -239,6 +243,7 @@ const pagination = reactive({
const columns = [
{ title: '课程包名称', key: 'name', width: 250 },
{ title: '课程主题', key: 'theme', width: 120 },
{ title: '关联绘本', key: 'pictureBook', width: 120 },
{ title: '课程配置', key: 'lessonConfig', width: 200 },
{ title: '状态', key: 'status', width: 90 },

View File

@ -96,6 +96,9 @@ public class CourseResponse {
@Schema(description = "主题 ID")
private Long themeId;
@Schema(description = "主题名称")
private String themeName;
@Schema(description = "绘本名称")
private String pictureBookName;

View File

@ -16,9 +16,11 @@ import com.reading.platform.entity.CourseLesson;
import com.reading.platform.entity.CoursePackage;
import com.reading.platform.entity.LessonStep;
import com.reading.platform.entity.TenantPackage;
import com.reading.platform.entity.Theme;
import com.reading.platform.mapper.CourseCollectionPackageMapper;
import com.reading.platform.mapper.CoursePackageMapper;
import com.reading.platform.mapper.TenantPackageMapper;
import com.reading.platform.mapper.ThemeMapper;
import com.reading.platform.service.CourseLessonService;
import com.reading.platform.service.CoursePackageService;
import lombok.RequiredArgsConstructor;
@ -47,6 +49,7 @@ public class CoursePackageServiceImpl extends ServiceImpl<CoursePackageMapper, C
private final com.reading.platform.common.mapper.CoursePackageMapper coursePackageVoMapper;
private final CourseCollectionPackageMapper collectionPackageMapper;
private final TenantPackageMapper tenantPackageMapper;
private final ThemeMapper themeMapper;
@Override
@Transactional(rollbackFor = Exception.class)
@ -109,6 +112,13 @@ public class CoursePackageServiceImpl extends ServiceImpl<CoursePackageMapper, C
public CourseResponse getCourseByIdWithLessons(Long id) {
CoursePackage entity = getCourseById(id);
CourseResponse response = coursePackageVoMapper.toVO(entity);
// 填充主题名称
if (entity.getThemeId() != null) {
Theme theme = themeMapper.selectById(entity.getThemeId());
if (theme != null) {
response.setThemeName(theme.getName());
}
}
List<CourseLesson> lessons = courseLessonService.findByCourseId(id);
List<CourseLessonResponse> lessonResponses = lessons.stream()
.map(this::toLessonResponse)