修复 讲师维护 附件上传

master
xiaochanghai 11 months ago
parent 235c7f69d3
commit 92e61f25c1
  1. 2
      Tiobon.Core.Model/Edit/Ghre/Ghre_TeacherAttachment.Dto.EditInput.cs
  2. 2
      Tiobon.Core.Model/Insert/Ghre/Ghre_TeacherAttachment.Dto.InsertInput.cs
  3. 2
      Tiobon.Core.Model/View/Ghre/Ghre_TeacherAttachment.Dto.View.cs
  4. 17
      Tiobon.Core.Services/Ghre/Ghre_TeacherServices.cs

@ -27,6 +27,6 @@ namespace Tiobon.Core.Model.Models
{ {
[NotMapped] [NotMapped]
public List<EditGhrs_AttachmentInput> Attachments { get; set; } public List<EditGhre_AttachmentInput> Attachments { get; set; }
} }
} }

@ -26,6 +26,6 @@ namespace Tiobon.Core.Model.Models
public class InsertGhre_TeacherAttachmentInput : Ghre_TeacherAttachmentBase public class InsertGhre_TeacherAttachmentInput : Ghre_TeacherAttachmentBase
{ {
[NotMapped] [NotMapped]
public List<InsertGhrs_AttachmentInput> Attachments { get; set; } public List<InsertGhre_AttachmentInput> Attachments { get; set; }
} }
} }

@ -32,5 +32,5 @@ public class Ghre_TeacherAttachmentDto : Ghre_TeacherAttachment
/// </summary> /// </summary>
public string UpdateDataInfo { get; set; } public string UpdateDataInfo { get; set; }
public List<Ghrs_AttachmentDto> Attachments { get; set; } = new List<Ghrs_AttachmentDto>(); public List<Ghre_AttachmentDto> Attachments { get; set; } = new List<Ghre_AttachmentDto>();
} }

@ -8,7 +8,6 @@ using Tiobon.Core.Common;
using Tiobon.Core.Model; using Tiobon.Core.Model;
using AgileObjects.AgileMapper; using AgileObjects.AgileMapper;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Tiobon.Core.Common.DB.Dapper.Extensions;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Tiobon.Core.Services; namespace Tiobon.Core.Services;
@ -19,17 +18,17 @@ namespace Tiobon.Core.Services;
public class Ghre_TeacherServices : BaseServices<Ghre_Teacher, Ghre_TeacherDto, InsertGhre_TeacherInput, EditGhre_TeacherInput>, IGhre_TeacherServices public class Ghre_TeacherServices : BaseServices<Ghre_Teacher, Ghre_TeacherDto, InsertGhre_TeacherInput, EditGhre_TeacherInput>, IGhre_TeacherServices
{ {
private readonly IBaseRepository<Ghre_Teacher> _dal; private readonly IBaseRepository<Ghre_Teacher> _dal;
private IGhrs_AttachmentServices _ghrs_AttachmentServices; private IGhre_AttachmentServices _ghre_AttachmentServices;
private IGhre_TeacherAttachmentServices _ghre_TeacherAttachmentServices; private IGhre_TeacherAttachmentServices _ghre_TeacherAttachmentServices;
public Ghre_TeacherServices(ICaching caching, public Ghre_TeacherServices(ICaching caching,
IGhrs_AttachmentServices ghrs_AttachmentServices, IGhre_AttachmentServices ghre_AttachmentServices,
IGhre_TeacherAttachmentServices ghre_TeacherAttachmentServices, IGhre_TeacherAttachmentServices ghre_TeacherAttachmentServices,
IBaseRepository<Ghre_Teacher> dal) IBaseRepository<Ghre_Teacher> dal)
{ {
this._dal = dal; this._dal = dal;
base.BaseDal = dal; base.BaseDal = dal;
base._caching = caching; base._caching = caching;
_ghrs_AttachmentServices = ghrs_AttachmentServices; _ghre_AttachmentServices = ghre_AttachmentServices;
_ghre_TeacherAttachmentServices = ghre_TeacherAttachmentServices; _ghre_TeacherAttachmentServices = ghre_TeacherAttachmentServices;
} }
@ -174,7 +173,7 @@ FROM (SELECT A.*,
var ids = entitys.Select(x => x.Id).ToList(); var ids = entitys.Select(x => x.Id).ToList();
var teacherAttachments = await _ghre_TeacherAttachmentServices.QueryDto(x => ids.Contains(x.TeacherId.Value)); var teacherAttachments = await _ghre_TeacherAttachmentServices.QueryDto(x => ids.Contains(x.TeacherId.Value));
var ids1 = teacherAttachments.Select(x => x.Id.ToString()).ToList(); var ids1 = teacherAttachments.Select(x => x.Id.ToString()).ToList();
var attachments = await _ghrs_AttachmentServices.QueryDto(x => ids1.Contains(x.TableName)); var attachments = await _ghre_AttachmentServices.QueryDto(x => ids1.Contains(x.TableName));
teacherAttachments.ForEach(x => teacherAttachments.ForEach(x =>
{ {
@ -221,8 +220,8 @@ FROM (SELECT A.*,
if (insert.Attachments != null && insert.Attachments.Any()) if (insert.Attachments != null && insert.Attachments.Any())
for (int j = 0; j < insert.Attachments.Count; j++) for (int j = 0; j < insert.Attachments.Count; j++)
{ {
await Db.Updateable<Ghrs_Attachment>() await Db.Updateable<Ghre_Attachment>()
.SetColumns(it => new Ghrs_Attachment() { TableName = teacherAttachmentId.ToString(), UpdateTime = DateTime.Now }) .SetColumns(it => new Ghre_Attachment() { TableName = teacherAttachmentId.ToString(), UpdateTime = DateTime.Now })
.Where(it => it.RelativePath == insert.Attachments[j].RelativePath) .Where(it => it.RelativePath == insert.Attachments[j].RelativePath)
.ExecuteCommandAsync(); .ExecuteCommandAsync();
} }
@ -260,8 +259,8 @@ FROM (SELECT A.*,
if (insert.Attachments != null && insert.Attachments.Any()) if (insert.Attachments != null && insert.Attachments.Any())
for (int j = 0; j < insert.Attachments.Count; j++) for (int j = 0; j < insert.Attachments.Count; j++)
{ {
await Db.Updateable<Ghrs_Attachment>() await Db.Updateable<Ghre_Attachment>()
.SetColumns(it => new Ghrs_Attachment() { TableName = TeacherAttachmentId.ToString(), UpdateTime = DateTime.Now }) .SetColumns(it => new Ghre_Attachment() { TableName = TeacherAttachmentId.ToString(), UpdateTime = DateTime.Now })
.Where(it => it.RelativePath == insert.Attachments[j].RelativePath) .Where(it => it.RelativePath == insert.Attachments[j].RelativePath)
.ExecuteCommandAsync(); .ExecuteCommandAsync();
} }

Loading…
Cancel
Save