|
|
|
@ -18,17 +18,17 @@ namespace Tiobon.Core.Services; |
|
|
|
|
public class Ghre_SchoolServices : BaseServices<Ghre_School, Ghre_SchoolDto, InsertGhre_SchoolInput, EditGhre_SchoolInput>, IGhre_SchoolServices |
|
|
|
|
{ |
|
|
|
|
private readonly IBaseRepository<Ghre_School> _dal; |
|
|
|
|
private IGhrs_AttachmentServices _ghrs_AttachmentServices; |
|
|
|
|
private IGhre_AttachmentServices _ghre_AttachmentServices; |
|
|
|
|
private IGhre_SchoolAttachmentServices _ghre_SchoolAttachmentServices; |
|
|
|
|
public Ghre_SchoolServices(ICaching caching, |
|
|
|
|
IGhrs_AttachmentServices ghrs_AttachmentServices, |
|
|
|
|
IGhre_AttachmentServices ghre_AttachmentServices, |
|
|
|
|
IGhre_SchoolAttachmentServices ghre_SchoolAttachmentServices, |
|
|
|
|
IBaseRepository<Ghre_School> dal) |
|
|
|
|
{ |
|
|
|
|
this._dal = dal; |
|
|
|
|
base.BaseDal = dal; |
|
|
|
|
base._caching = caching; |
|
|
|
|
_ghrs_AttachmentServices = ghrs_AttachmentServices; |
|
|
|
|
_ghre_AttachmentServices = ghre_AttachmentServices; |
|
|
|
|
_ghre_SchoolAttachmentServices = ghre_SchoolAttachmentServices; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -68,7 +68,7 @@ public class Ghre_SchoolServices : BaseServices<Ghre_School, Ghre_SchoolDto, Ins |
|
|
|
|
var ids = entitys.Select(x => x.Id).ToList(); |
|
|
|
|
var schoolAttachments = await _ghre_SchoolAttachmentServices.QueryDto(x => ids.Contains(x.SchoolId.Value)); |
|
|
|
|
var ids1 = schoolAttachments.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)); |
|
|
|
|
|
|
|
|
|
schoolAttachments.ForEach(x => |
|
|
|
|
{ |
|
|
|
@ -97,8 +97,8 @@ public class Ghre_SchoolServices : BaseServices<Ghre_School, Ghre_SchoolDto, Ins |
|
|
|
|
if (insert.Attachments != null && insert.Attachments.Any()) |
|
|
|
|
for (int j = 0; j < insert.Attachments.Count; j++) |
|
|
|
|
{ |
|
|
|
|
await Db.Updateable<Ghrs_Attachment>() |
|
|
|
|
.SetColumns(it => new Ghrs_Attachment() { TableName = schoolAttachmentId.ToString(), UpdateTime = DateTime.Now }) |
|
|
|
|
await Db.Updateable<Ghre_Attachment>() |
|
|
|
|
.SetColumns(it => new Ghre_Attachment() { TableName = schoolAttachmentId.ToString(), UpdateTime = DateTime.Now }) |
|
|
|
|
.Where(it => it.RelativePath == insert.Attachments[j].RelativePath) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
} |
|
|
|
@ -122,8 +122,8 @@ public class Ghre_SchoolServices : BaseServices<Ghre_School, Ghre_SchoolDto, Ins |
|
|
|
|
if (insert.Attachments != null && insert.Attachments.Any()) |
|
|
|
|
for (int j = 0; j < insert.Attachments.Count; j++) |
|
|
|
|
{ |
|
|
|
|
await Db.Updateable<Ghrs_Attachment>() |
|
|
|
|
.SetColumns(it => new Ghrs_Attachment() { TableName = schoolAttachmentId.ToString(), UpdateTime = DateTime.Now }) |
|
|
|
|
await Db.Updateable<Ghre_Attachment>() |
|
|
|
|
.SetColumns(it => new Ghre_Attachment() { TableName = schoolAttachmentId.ToString(), UpdateTime = DateTime.Now }) |
|
|
|
|
.Where(it => it.RelativePath == insert.Attachments[j].RelativePath) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
} |
|
|
|
|