diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs index e6f3eb9a..bbec845d 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs @@ -259,4 +259,14 @@ public class Ghre_ExamRecordController : BaseController + /// 提交附件 + /// + /// + /// + [HttpPost("SubmitAttachment/{examRecordId}")] + public async Task SubmitAttachment(long examRecordId, [FromBody] List attachments) + { + return await _service.SubmitAttachment(examRecordId, attachments); + } } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 4f53e2fc..116a0ddd 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -1058,6 +1058,13 @@ + + + 提交附件 + + + + Ghre_ExamRecordDetail(Controller) diff --git a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs index 02d30f76..c8226b69 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs @@ -30,4 +30,6 @@ public interface IGhre_ExamRecordServices : IBaseServices ModifyActualScore(string examRecordId, EditGhre_ExamRecordInput edit); Task ModifyIsPass(string examRecordId, EditGhre_ExamRecordInput edit); + + Task SubmitAttachment(long examRecordId, List attachments); } \ No newline at end of file diff --git a/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs b/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs index 67b53c8f..4aa609dc 100644 --- a/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs @@ -55,5 +55,5 @@ public class Ghre_ExamRecordDto : Ghre_ExamRecord public decimal? TotalScore { get; set; } = 0; - + public List Attachments { get; set; } } diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs index 39bcbb12..504170ba 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs @@ -94,6 +94,11 @@ public class Ghre_ExamRecordServices : BaseServices(sql); + var attachments = new List(); + var ids = entitys.Select(x => x.Id.ToString()).ToList(); + if (ids.Count > 0) + attachments = await Db.Queryable().Where(x => ids.Contains(x.TableName)).ToListAsync(); + entitys.ForEach(async x => { x.ScoreMethodLabel = await GetParaLabel("ScoreMethod", x.ScoreMethod); @@ -102,7 +107,7 @@ public class Ghre_ExamRecordServices : BaseServices o.TableName == x.Id.ToString()).ToList(); //x.InStatusLabel = x.InStatus == "1" ? "在职" : null; //x.InStatusLabel = x.InStatus == "2" ? "离职" : null; //x.InStatusLabel = x.InStatus == "0" ? "未入职" : null; @@ -1039,8 +1044,6 @@ public class Ghre_ExamRecordServices : BaseServices> DownloadExcel(string menuName) { @@ -1265,4 +1268,20 @@ public class Ghre_ExamRecordServices : BaseServices.OprateSuccess("导入成功!", data); } #endregion + + #region 提交附件 + public async Task SubmitAttachment(long examRecordId, List attachments) + { + var paths = attachments.Select(x => x.PhysicsPath).Distinct().ToList(); + await Db.Updateable() + .SetColumns(it => new Ghre_Attachment() { TableName = null }) + .Where(it => it.TableName == examRecordId.ObjToString()) + .ExecuteCommandAsync(); + await Db.Updateable() + .SetColumns(it => new Ghre_Attachment() { TableName = examRecordId.ObjToString() }) + .Where(it => paths.Contains(it.PhysicsPath)) + .ExecuteCommandAsync(); + return ServiceResult.OprateSuccess("保存成功!"); + } + #endregion } \ No newline at end of file diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 4f53e2fc..116a0ddd 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -1058,6 +1058,13 @@ + + + 提交附件 + + + + Ghre_ExamRecordDetail(Controller)