|
|
@ -15,6 +15,7 @@ using Tiobon.Core.Common.UserManager; |
|
|
|
using Tiobon.Core.Common.Helper; |
|
|
|
using Tiobon.Core.Common.Helper; |
|
|
|
using AgileObjects.AgileMapper; |
|
|
|
using AgileObjects.AgileMapper; |
|
|
|
using static Tiobon.Core.Model.Consts; |
|
|
|
using static Tiobon.Core.Model.Consts; |
|
|
|
|
|
|
|
using MySqlX.XDevAPI.Common; |
|
|
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
|
|
|
|
|
|
|
@ -379,7 +380,28 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
//entity.SchoolId = teacher.SchoolId; |
|
|
|
//entity.SchoolId = teacher.SchoolId; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return await base.Add(entity); |
|
|
|
var result = await base.Add(entity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 课程ID 同步至课件 |
|
|
|
|
|
|
|
if (!entity.CourseWareId.IsNull()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var ware = await Db.Queryable<Ghre_CourseWare>().FirstAsync(x => x.Id == entity.CourseWareId); |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(ware.CourseIds)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var courseIds2 = JsonConvert.DeserializeObject<List<long>>(ware.CourseIds); |
|
|
|
|
|
|
|
if (!courseIds2.Any(x => x == result)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
courseIds2.Add(result); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ware.CourseIds = JsonConvert.SerializeObject(courseIds2); |
|
|
|
|
|
|
|
await Db.Updateable<Ghre_CourseWare>().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override async Task<bool> Update(long Id, EditGhre_CourseInput editModel) |
|
|
|
public override async Task<bool> Update(long Id, EditGhre_CourseInput editModel) |
|
|
@ -420,7 +442,28 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
editModel.IsOPen = editModel.IsOPenLabel; |
|
|
|
editModel.IsOPen = editModel.IsOPenLabel; |
|
|
|
return await base.Update(Id, editModel); |
|
|
|
|
|
|
|
|
|
|
|
var result = await base.Update(Id, editModel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 课程ID 同步至课件 |
|
|
|
|
|
|
|
if (!editModel.CourseWareId.IsNull()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var ware = await Db.Queryable<Ghre_CourseWare>().FirstAsync(x => x.Id == editModel.CourseWareId); |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(ware.CourseIds)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var courseIds2 = JsonConvert.DeserializeObject<List<long>>(ware.CourseIds); |
|
|
|
|
|
|
|
if (!courseIds2.Any(x => x == Id)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
courseIds2.Add(Id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ware.CourseIds = JsonConvert.SerializeObject(courseIds2); |
|
|
|
|
|
|
|
await Db.Updateable<Ghre_CourseWare>().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region 获取通用列表下拉 |
|
|
|
#region 获取通用列表下拉 |
|
|
|