移动文件夹修改
parent
1095e07f87
commit
a713ffdc61
|
@ -588,39 +588,6 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
||||||
throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotMove"]);
|
throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotMove"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var id in inDto.Ids)
|
|
||||||
{
|
|
||||||
var node = await _auditDocumentRepository.FirstOrDefaultAsync(t => t.Id == id);
|
|
||||||
|
|
||||||
//找到设置父节点的儿子节点
|
|
||||||
var existSameName = await _auditDocumentClosureRepository
|
|
||||||
.Where(t => t.AncestorId == inDto.ParentId && t.Depth == 1)
|
|
||||||
.Select(t => t.Descendant).AnyAsync(t => t.Name == node.Name && t.AuditDocumentTypeEnum == node.AuditDocumentTypeEnum);
|
|
||||||
|
|
||||||
//不存在同名节点,那么直接移动
|
|
||||||
if (!existSameName)
|
|
||||||
{
|
|
||||||
//移动ParentId
|
|
||||||
|
|
||||||
|
|
||||||
node.ParentId = inDto.ParentId;
|
|
||||||
|
|
||||||
await _auditDocumentRepository.SaveChangesAsync();
|
|
||||||
|
|
||||||
|
|
||||||
// 删除原有闭包关系
|
|
||||||
await _auditDocumentClosureRepository.BatchDeleteNoTrackingAsync(t => matchIdQuery.Contains(t.DescendantId) || matchIdQuery.Contains(t.AncestorId));
|
|
||||||
|
|
||||||
|
|
||||||
//建立新的节点的闭包关系
|
|
||||||
await AddClosureRelationsAsync(node.Id, inDto.ParentId);
|
|
||||||
|
|
||||||
//建立新的节点后的子孙后代闭包关系 不包括自己
|
|
||||||
|
|
||||||
//var chai _auditDocumentClosureRepository.Where(t => t.AncestorId == id && t.Depth > 0).OrderBy(t => t.Depth).Select(t => t.DescendantId);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,9 +106,15 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
public AuditDocument Descendant { get; set; }
|
public AuditDocument Descendant { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 父Id
|
||||||
|
/// </summary>
|
||||||
[Comment("祖先")]
|
[Comment("祖先")]
|
||||||
public Guid AncestorId { get; set; }
|
public Guid AncestorId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 子Id
|
||||||
|
/// </summary>
|
||||||
[Comment("后代")]
|
[Comment("后代")]
|
||||||
public Guid DescendantId { get; set; }
|
public Guid DescendantId { get; set; }
|
||||||
public int Depth { get; set; } // 0=自己, 1=直接子节点, 2=孙节点...
|
public int Depth { get; set; } // 0=自己, 1=直接子节点, 2=孙节点...
|
||||||
|
|
Loading…
Reference in New Issue