From b89d5594c7e2be67587d3c33ef4d416df1fffe1a Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Tue, 1 Apr 2025 14:36:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B1=82=E6=96=B0=E5=A2=9E=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E9=9C=80=E6=B1=82=E6=97=B6=E9=BB=98=E8=AE=A4=E5=9F=B9=E8=AE=AD?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E4=B8=BA=E7=94=B3=E8=AF=B7=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/Ghre/Ghre_Request.Dto.Base.cs | 4 ++-- Tiobon.Core.Model/Models/Ghre/Ghre_Request.cs | 4 ++-- .../Ghre/Ghre_RequestServices.cs | 21 +++++++++++++------ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Tiobon.Core.Model/Base/Ghre/Ghre_Request.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghre/Ghre_Request.Dto.Base.cs index 55a1c30c..50ec4b6b 100644 --- a/Tiobon.Core.Model/Base/Ghre/Ghre_Request.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghre/Ghre_Request.Dto.Base.cs @@ -66,7 +66,7 @@ public class Ghre_RequestBase /// /// 申请人 /// - public long? ApplicantId { get; set; } + public int? ApplicantId { get; set; } /// /// 需求人数 @@ -124,7 +124,7 @@ public class Ghre_RequestBase /// /// 发起人 /// - public long? SponsorId { get; set; } + public int? SponsorId { get; set; } /// /// 状态 diff --git a/Tiobon.Core.Model/Models/Ghre/Ghre_Request.cs b/Tiobon.Core.Model/Models/Ghre/Ghre_Request.cs index 46bc6832..9f7e77d6 100644 --- a/Tiobon.Core.Model/Models/Ghre/Ghre_Request.cs +++ b/Tiobon.Core.Model/Models/Ghre/Ghre_Request.cs @@ -67,7 +67,7 @@ public class Ghre_Request : BasePoco /// /// 申请人 /// - public long? ApplicantId { get; set; } + public int? ApplicantId { get; set; } /// /// 需求人数 @@ -125,7 +125,7 @@ public class Ghre_Request : BasePoco /// /// 发起人 /// - public long? SponsorId { get; set; } + public int? SponsorId { get; set; } /// /// 状态 diff --git a/Tiobon.Core.Services/Ghre/Ghre_RequestServices.cs b/Tiobon.Core.Services/Ghre/Ghre_RequestServices.cs index b49adbd9..ddc8a43e 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_RequestServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_RequestServices.cs @@ -41,7 +41,7 @@ FROM Ghre_Request A if (!string.IsNullOrWhiteSpace(trainStaffId)) { x.TrainStaffIds = JsonHelper.JsonToObj>(trainStaffId); - var TrainStaffIds = JsonHelper.JsonToObj>(trainStaffId); + var TrainStaffIds = JsonHelper.JsonToObj>(trainStaffId); sponsorIds.AddRange(TrainStaffIds); } @@ -117,7 +117,12 @@ FROM Ghre_Request A throw new Exception("培训对象数量须和需求人数保持一致!"); } } - else entity.RequestNum = 1; + else + { + + entity.RequestNum = 1; + entity.TrainStaffId = $"[{entity.ApplicantId}]"; + } var id = await base.Add(entity); var sql = $"SELECT ISNULL(MAX(id)+1,1) FROM Ghre_Request WHERE Id !='{id}'"; @@ -130,6 +135,9 @@ FROM Ghre_Request A public override async Task Update(long Id, EditGhre_RequestInput entity) { + if (entity.TrainStaffIds.IsNotEmptyOrNull()) + entity.TrainStaffId = JsonHelper.ObjToJson(entity.TrainStaffIds); + else entity.TrainStaffId = null; if (entity.RequestSource == "Dept") { if (await QueryCompanyCode() == "Ushio") @@ -143,10 +151,11 @@ FROM Ghre_Request A throw new Exception("培训对象数量须和需求人数保持一致!"); } } - else entity.RequestNum = 1; - if (entity.TrainStaffIds.IsNotEmptyOrNull()) - entity.TrainStaffId = JsonHelper.ObjToJson(entity.TrainStaffIds); - else entity.TrainStaffId = null; + else + { + entity.RequestNum = 1; + entity.TrainStaffId = $"[{entity.ApplicantId}]"; + } return await base.Update(Id, entity, null, ["Status"]); } public async Task> InsertByStatus(InsertGhre_RequestInput insertModel, string status)