考试记录新增附件上传

master
xiaochanghai 5 months ago
parent 5f67916b15
commit fe3d0398dd
  1. 10
      Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs
  2. 7
      Tiobon.Core.Api/Tiobon.Core.xml
  3. 2
      Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs
  4. 2
      Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs
  5. 25
      Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs
  6. 7
      Tiobon.Core/Tiobon.Core.xml

@ -259,4 +259,14 @@ public class Ghre_ExamRecordController : BaseController<IGhre_ExamRecordServices
return result;
}
/// <summary>
/// 提交附件
/// </summary>
/// <param name="examRecordId"></param>
/// <returns></returns>
[HttpPost("SubmitAttachment/{examRecordId}")]
public async Task<ServiceResult> SubmitAttachment(long examRecordId, [FromBody] List<InsertGhre_AttachmentInput> attachments)
{
return await _service.SubmitAttachment(examRecordId, attachments);
}
}

@ -1058,6 +1058,13 @@
<param name="examRecordId"></param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_ExamRecordController.SubmitAttachment(System.Int64,System.Collections.Generic.List{Tiobon.Core.Model.Models.InsertGhre_AttachmentInput})">
<summary>
提交附件
</summary>
<param name="examRecordId"></param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_ExamRecordDetailController">
<summary>
Ghre_ExamRecordDetail(Controller)

@ -30,4 +30,6 @@ public interface IGhre_ExamRecordServices : IBaseServices<Ghre_ExamRecord, Ghre_
Task<ServiceResult> ModifyActualScore(string examRecordId, EditGhre_ExamRecordInput edit);
Task<ServiceResult> ModifyIsPass(string examRecordId, EditGhre_ExamRecordInput edit);
Task<ServiceResult> SubmitAttachment(long examRecordId, List<InsertGhre_AttachmentInput> attachments);
}

@ -55,5 +55,5 @@ public class Ghre_ExamRecordDto : Ghre_ExamRecord
public decimal? TotalScore { get; set; } = 0;
public List<Ghre_Attachment> Attachments { get; set; }
}

@ -94,6 +94,11 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
var entitys = await Db.Ado.SqlQueryAsync<Ghre_ExamRecordDto>(sql);
var attachments = new List<Ghre_Attachment>();
var ids = entitys.Select(x => x.Id.ToString()).ToList();
if (ids.Count > 0)
attachments = await Db.Queryable<Ghre_Attachment>().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<Ghre_ExamRecord, Ghre_ExamRe
//x.StudyStatusLabel = await GetParaLabel("TrainingStudyStatus", x.StudyStatus);
if (x.IsPass != null)
x.IsPassLabel = x.IsPass == true ? "合格" : "不合格";
x.Attachments = attachments.Where(o => 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<Ghre_ExamRecord, Ghre_ExamRe
return ServiceResult.OprateSuccess("成功!");
}
#region Excel导入
public override async Task<ServiceResult<string>> DownloadExcel(string menuName)
{
@ -1265,4 +1268,20 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
return ServiceResult<ExcelData>.OprateSuccess("导入成功!", data);
}
#endregion
#region 提交附件
public async Task<ServiceResult> SubmitAttachment(long examRecordId, List<InsertGhre_AttachmentInput> attachments)
{
var paths = attachments.Select(x => x.PhysicsPath).Distinct().ToList();
await Db.Updateable<Ghre_Attachment>()
.SetColumns(it => new Ghre_Attachment() { TableName = null })
.Where(it => it.TableName == examRecordId.ObjToString())
.ExecuteCommandAsync();
await Db.Updateable<Ghre_Attachment>()
.SetColumns(it => new Ghre_Attachment() { TableName = examRecordId.ObjToString() })
.Where(it => paths.Contains(it.PhysicsPath))
.ExecuteCommandAsync();
return ServiceResult.OprateSuccess("保存成功!");
}
#endregion
}

@ -1058,6 +1058,13 @@
<param name="examRecordId"></param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_ExamRecordController.SubmitAttachment(System.Int64,System.Collections.Generic.List{Tiobon.Core.Model.Models.InsertGhre_AttachmentInput})">
<summary>
提交附件
</summary>
<param name="examRecordId"></param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_ExamRecordDetailController">
<summary>
Ghre_ExamRecordDetail(Controller)

Loading…
Cancel
Save