培训缺陷 修复

master
xiaochanghai 6 months ago
parent 56abc6fd0b
commit ad58cd89d7
  1. 16
      Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs

@ -51,7 +51,7 @@ public class Ghre_CourseWareServices : BaseServices<Ghre_CourseWare, Ghre_Course
{
editModel.CourseIds = JsonConvert.SerializeObject(editModel.CourseIds2);
var courses = await _ghre_CourseServices.Query(x => 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<Ghre_CourseWare, Ghre_Course
var result = await base.QueryFilterPage(filter, condition);
var data = result.result.DT_TableDataT1;
var attachmentIds = data.Select(x => x.Id).ToList();
var courseIds = new List<long>();
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<List<long>>(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;

Loading…
Cancel
Save