diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml
index 3a92f148..434f33dc 100644
--- a/Tiobon.Core.Api/Tiobon.Core.Model.xml
+++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml
@@ -1308,7 +1308,7 @@
课件ID
-
+
@@ -7094,7 +7094,7 @@
课件ID
-
+
diff --git a/Tiobon.Core.Model/Base/Ghre/Ghre_Course.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghre/Ghre_Course.Dto.Base.cs
index 261be496..c5f05b32 100644
--- a/Tiobon.Core.Model/Base/Ghre/Ghre_Course.Dto.Base.cs
+++ b/Tiobon.Core.Model/Base/Ghre/Ghre_Course.Dto.Base.cs
@@ -52,9 +52,8 @@ namespace Tiobon.Core.Model.Models
///
/// 课件ID
- ///
- [Display(Name = "CourseWareId"), Description("课件ID"), MaxLength(2000, ErrorMessage = "课件ID 不能超过 2000 个字符")]
- public string CourseWareId { get; set; }
+ ///
+ public long? CourseWareId { get; set; }
///
/// 标准课时
diff --git a/Tiobon.Core.Model/Models/Ghre/Ghre_Course.cs b/Tiobon.Core.Model/Models/Ghre/Ghre_Course.cs
index 5e472abb..2f2952bd 100644
--- a/Tiobon.Core.Model/Models/Ghre/Ghre_Course.cs
+++ b/Tiobon.Core.Model/Models/Ghre/Ghre_Course.cs
@@ -54,9 +54,8 @@ namespace Tiobon.Core.Model.Models
///
/// 课件ID
- ///
- [Display(Name = "CourseWareId"), Description("课件ID"), MaxLength(2000, ErrorMessage = "课件ID 不能超过 2000 个字符")]
- public string CourseWareId { get; set; }
+ ///
+ public long? CourseWareId { get; set; }
///
/// 标准课时
diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs
index 8b1d8f43..8a20e1c6 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs
@@ -15,6 +15,7 @@ using Tiobon.Core.Common.UserManager;
using Tiobon.Core.Common.Helper;
using AgileObjects.AgileMapper;
using static Tiobon.Core.Model.Consts;
+using MySqlX.XDevAPI.Common;
namespace Tiobon.Core.Services;
@@ -379,7 +380,28 @@ public class Ghre_CourseServices : BaseServices().FirstAsync(x => x.Id == entity.CourseWareId);
+ if (!string.IsNullOrWhiteSpace(ware.CourseIds))
+ {
+ var courseIds2 = JsonConvert.DeserializeObject>(ware.CourseIds);
+ if (!courseIds2.Any(x => x == result))
+ {
+ courseIds2.Add(result);
+
+ ware.CourseIds = JsonConvert.SerializeObject(courseIds2);
+ await Db.Updateable().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync();
+ }
+ }
+
+ }
+ #endregion
+
+ return result;
}
public override async Task Update(long Id, EditGhre_CourseInput editModel)
@@ -420,7 +442,28 @@ public class Ghre_CourseServices : BaseServices().FirstAsync(x => x.Id == editModel.CourseWareId);
+ if (!string.IsNullOrWhiteSpace(ware.CourseIds))
+ {
+ var courseIds2 = JsonConvert.DeserializeObject>(ware.CourseIds);
+ if (!courseIds2.Any(x => x == Id))
+ {
+ courseIds2.Add(Id);
+
+ ware.CourseIds = JsonConvert.SerializeObject(courseIds2);
+ await Db.Updateable().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync();
+ }
+ }
+
+ }
+ #endregion
+ return result;
}
#region 获取通用列表下拉
diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs
index d1a2de5b..0b45423b 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs
@@ -377,6 +377,7 @@ public class Ghre_ExamRecordServices : BaseServices().AnyAsync(x => x.Id == id))
{
var examRecord = await Db.Queryable().FirstAsync(x => x.StudyRecordId == id);
@@ -429,7 +430,7 @@ public class Ghre_ExamRecordServices : BaseServices.OprateFailed("无效的考试ID!");
diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs
index 1eee64a7..8f44b3f2 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs
@@ -18,7 +18,6 @@ using Tiobon.Core.Common.DB.Dapper;
using Tiobon.Core.Common.Helper;
using System.Data;
using static Tiobon.Core.Model.Consts;
-using Org.BouncyCastle.Crypto;
namespace Tiobon.Core.Services;
@@ -1124,7 +1123,7 @@ public class Ghre_ExamServices : BaseServices().SetColumns(it => it.LinkTimes == it.LinkTimes + 1).Where(it => it.Id == insert.ExamPaperId).ExecuteCommand();
+ await Db.Updateable().SetColumns(it => it.LinkTimes == it.LinkTimes + 1).Where(it => it.Id == insert.ExamPaperId).ExecuteCommandAsync();
return ServiceResult.OprateSuccess("添加成功!", id);
}
@@ -1133,8 +1132,8 @@ public class Ghre_ExamServices : BaseServices().SetColumns(it => it.LinkTimes == it.LinkTimes - 1).Where(it => it.Id == exam.ExamPaperId && it.LinkTimes > 0).ExecuteCommand();
- Db.Updateable().SetColumns(it => it.LinkTimes == it.LinkTimes + 1).Where(it => it.Id == pageData.ExamPaperId).ExecuteCommand();
+ await Db.Updateable().SetColumns(it => it.LinkTimes == it.LinkTimes - 1).Where(it => it.Id == exam.ExamPaperId && it.LinkTimes > 0).ExecuteCommandAsync();
+ await Db.Updateable().SetColumns(it => it.LinkTimes == it.LinkTimes + 1).Where(it => it.Id == pageData.ExamPaperId).ExecuteCommandAsync();
}
var insert = Mapper.Map(pageData).ToANew();
await base.Update(id, insert);