From ad58cd89d7a2dbf95c92866616a9558c6d854497 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Mon, 23 Dec 2024 10:42:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E7=BC=BA=E9=99=B7=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_CourseWareServices.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs index 85271348..b5d1af81 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs @@ -51,7 +51,7 @@ public class Ghre_CourseWareServices : BaseServices editModel.CourseIds2.Contains(x.Id)); - editModel.CourseNames = string.Join(",", courses.Select(x => x.CourseName)); + editModel.CourseNames = string.Join("、", courses.Select(x => x.CourseNo + " " + x.CourseName)); } await _ghre_CourseWareAttachmentServices.Delete(x => x.CourseWareId == Id); @@ -178,16 +178,30 @@ public class Ghre_CourseWareServices : BaseServices x.Id).ToList(); + + var courseIds = new List(); var attachments = await _ghre_CourseWareAttachmentServices.Query(x => x.CourseWareId != null && attachmentIds.Contains(x.CourseWareId.Value)); data.ForEach(async x => { if (!string.IsNullOrWhiteSpace(x.CourseIds)) + { x.CourseIds2 = JsonConvert.DeserializeObject>(x.CourseIds); + courseIds.AddRange(x.CourseIds2); + } x.StudyDuration = $"{x.Hours}小时{x.Minutes}分钟"; x.SourceLabel = await GetParaLabel("CourseWareSource", x.Source); x.Attachments = attachments.Where(a => a.CourseWareId == x.Id).ToList(); }); + courseIds = courseIds.Distinct().ToList(); + + var courses = await _ghre_CourseServices.Query(x => courseIds.Contains(x.Id)); + + data.ForEach(x => + { + if (!string.IsNullOrWhiteSpace(x.CourseIds)) + x.CourseNames = string.Join("、", courses.Where(o => x.CourseIds2.Contains(o.Id)).Select(o => o.CourseNo + " " + o.CourseName)); + }); result.result.DT_TableDataT1 = data; return result;