From 1fbdccfdaf3fe8c5bf057c84934c469d7779e510 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Fri, 6 Jun 2025 17:18:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AF=81=E4=B9=A6=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E4=BF=9D=E5=AD=98=E8=87=B3=E6=A8=A1=E6=9D=BF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_CertificateController.cs | 6 +++- .../Ghre/Ghre_CertificateRuleController.cs | 24 ++++++++++++- .../Ghre/IGhre_CertificateRuleServices.cs | 2 ++ .../Ghre/Ghre_CertificateRuleServices.cs | 35 +++++++++++++++++++ Tiobon.Core/Tiobon.Core.xml | 6 ++++ 5 files changed, 71 insertions(+), 2 deletions(-) diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_CertificateController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_CertificateController.cs index b545134c..2d39d5c4 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_CertificateController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_CertificateController.cs @@ -1,4 +1,7 @@ -namespace Tiobon.Core.Api.Controllers; +using NPOI.XWPF.UserModel; +using SkyWalking.NetworkProtocol.V3; + +namespace Tiobon.Core.Api.Controllers; /// /// 培训记录(Controller) @@ -32,4 +35,5 @@ public class Ghre_CertificateController : BaseController /// 培训证书规则(Controller) @@ -23,4 +25,24 @@ public class Ghre_CertificateRuleController : BaseController + /// 根据条件查询数据 + /// + /// + [HttpPost("SaveTemplate/{Id}")] + public async Task SaveTemplate(long Id, [FromBody] EditGhre_CertificateRuleInput body) + { + var data = Success("更新成功"); + var flag = await _service.SaveTemplate(Id, body); + if (!flag) + return Failed("更新失败"); + return data; + + } + + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.IServices/Ghre/IGhre_CertificateRuleServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_CertificateRuleServices.cs index 35f38ccb..6fb05637 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_CertificateRuleServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_CertificateRuleServices.cs @@ -6,4 +6,6 @@ public interface IGhre_CertificateRuleServices : IBaseServices { Task> Preview(long id); + + Task SaveTemplate(long Id, EditGhre_CertificateRuleInput editModel); } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghre/Ghre_CertificateRuleServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CertificateRuleServices.cs index e10f82bc..b077e7d3 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CertificateRuleServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CertificateRuleServices.cs @@ -165,6 +165,41 @@ public class Ghre_CertificateRuleServices : BaseServices SaveTemplate(long Id, EditGhre_CertificateRuleInput editModel) + { + if (editModel.CourseSceneIds != null) + editModel.CourseSceneId1 = JsonHelper.ObjToJson(editModel.CourseSceneIds); + if (editModel.CourseIds != null) + editModel.CourseId1 = JsonHelper.ObjToJson(editModel.CourseIds); + + var entity = await base.QueryById(Id); + var template = Mapper.Map(entity).ToANew(); + Id = SnowFlakeSingle.Instance.NextId(); + template.Id = Id; + + Id = await Db.Insertable(template).ExecuteReturnSnowflakeIdAsync(); + + + var design = Mapper.Map(editModel.CertificateDesignerData).ToANew(); + design.CertificateRuleId = Id; + var items = new List(); + var designId = await Db.Insertable(design).ExecuteReturnSnowflakeIdAsync(); + if (editModel.CertificateDesignerData.containerItems != null) + for (int i = 0; i < editModel.CertificateDesignerData.containerItems.Count; i++) + { + var item = Mapper.Map(editModel.CertificateDesignerData.containerItems[i]).ToANew(); + item.id1 = editModel.CertificateDesignerData.containerItems[i].id; + item.CertificateRuleId = Id; + item.CertificateDesignId = designId; + item.Id = UtilHelper.GetSysId(); + await Db.Insertable(item).ExecuteReturnSnowflakeIdAsync(); + } + + return true; + } + + public override async Task> QueryForm(QueryForm body) { var result = await base.QueryForm(body); diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 5196f354..c9716450 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -778,6 +778,12 @@ + + + 根据条件查询数据 + + + 证书模板(Controller)