|
|
|
@ -1130,4 +1130,30 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
|
return new ServicePageResult<CoursePublic>(filter.pageNum, totalCount, filter.pageSize, data); |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region 场景ID获取课程 |
|
|
|
|
public async Task<ServiceResult<List<Ghre_CourseDto>>> QueryBySceneId(long courseSceneId) |
|
|
|
|
{ |
|
|
|
|
var entitys = await base.Query(x => x.CourseSceneId == courseSceneId); |
|
|
|
|
var courseWareIds = entitys.Select(x => x.CourseWareId).Distinct().ToList(); |
|
|
|
|
var attachments = await Db.Queryable<Ghre_CourseWareAttachment>().Where(x => courseWareIds.Contains(x.CourseWareId)).ToListAsync(); |
|
|
|
|
//var attachments = await _ghre_CourseWareAttachmentServices.Query(x => x.CourseWareId != null && attachmentIds.Contains(x.CourseWareId.Value)); |
|
|
|
|
|
|
|
|
|
var entitys1 = Mapper.Map(entitys).ToANew<List<Ghre_CourseDto>>(); |
|
|
|
|
entitys1.ForEach(x => |
|
|
|
|
{ |
|
|
|
|
x.CourseWareName = string.Join(",", attachments.Where(o => o.CourseWareId == x.CourseWareId).OrderBy(x => x.SortNo).Select(o => o.AttachmentName)); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return ServiceResult<List<Ghre_CourseDto>>.OprateSuccess("查询成功", entitys1); |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region 修改场景下课程顺序 |
|
|
|
|
public async Task<ServiceResult> ModifyCourseSortNo(List<Ghre_Course> courses) |
|
|
|
|
{ |
|
|
|
|
await Db.Updateable(courses).UpdateColumns(it => new { it.SortNo }).ExecuteCommandAsync(); |
|
|
|
|
return ServiceResult.OprateSuccess("执行成功!"); |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
} |