diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ConfigController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ConfigController.cs index 8a5b290d..cf634c57 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ConfigController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ConfigController.cs @@ -11,4 +11,14 @@ public class Ghre_ConfigController : BaseController + /// 批量更新数据 + /// + /// + [HttpPost, Route("BulkUpdateValue")] + public virtual async Task BulkUpdateValue([FromBody] List entitys) + { + return await _service.BulkUpdateValue(entitys); + } } \ No newline at end of file diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_RequestController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_RequestController.cs index 3ebf116d..5d8d8c25 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_RequestController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_RequestController.cs @@ -26,6 +26,8 @@ public class Ghre_RequestController : BaseController + + + 批量更新数据 + + + Ghre_CourseClass(Controller) diff --git a/Tiobon.Core.IServices/Ghre/IGhre_ConfigServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_ConfigServices.cs index 93930bce..8592d2fc 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_ConfigServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_ConfigServices.cs @@ -1,4 +1,5 @@ using Tiobon.Core.IServices.BASE; +using Tiobon.Core.Model; using Tiobon.Core.Model.Models; namespace Tiobon.Core.IServices @@ -8,5 +9,6 @@ namespace Tiobon.Core.IServices /// public interface IGhre_ConfigServices :IBaseServices { + Task BulkUpdateValue(List entitys); } } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghre/Ghre_ConfigServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ConfigServices.cs index e8f8411b..94a19480 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ConfigServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ConfigServices.cs @@ -4,12 +4,13 @@ using Tiobon.Core.Model.Models; using Tiobon.Core.Services.BASE; using Tiobon.Core.IRepository.Base; using Tiobon.Core.Common.Caches; +using Tiobon.Core.Model; namespace Tiobon.Core.Services { - /// - /// 参数配置 (服务) - /// + /// + /// 参数配置 (服务) + /// public class Ghre_ConfigServices : BaseServices, IGhre_ConfigServices { private readonly IBaseRepository _dal; @@ -19,5 +20,19 @@ namespace Tiobon.Core.Services base.BaseDal = dal; base._caching = caching; } + + public async Task BulkUpdateValue(List entitys) + { + for (int i = 0; i < entitys.Count; i++) + { + await Db.Updateable() + .SetColumns(it => new Ghre_Config() + { + ConfigValue = entitys[i].ConfigValue + }) + .Where(x => x.Id == entitys[i].Id).ExecuteCommandAsync(); + } + return ServiceResult.OprateSuccess(); + } } } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghre/Ghre_RequestServices.cs b/Tiobon.Core.Services/Ghre/Ghre_RequestServices.cs index c0da2c4d..71956f71 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_RequestServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_RequestServices.cs @@ -32,7 +32,11 @@ public class Ghre_RequestServices : BaseServices> QueryFilterPage(QueryBody filter, string condition, bool? IsEnable = true) { - var sql = "update A set A.CourseName= B.CourseName FROM Ghre_Request A join Ghre_Course B on A.CourseId = B.Id and A.CourseName != B.CourseName"; + var sql = @"UPDATE A +SET A.CourseName = B.CourseName +FROM Ghre_Request A + JOIN Ghre_Course B + ON A.CourseId = B.Id AND (A.CourseName ! = B.CourseName OR A.CourseName IS NULL)"; await Db.Ado.ExecuteCommandAsync(sql); var result = await base.QueryFilterPage(filter, condition, IsEnable); diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index dbe355f5..ab37f7bd 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -649,6 +649,12 @@ 参数配置(Controller) + + + 批量更新数据 + + + Ghre_CourseClass(Controller)