移动文件夹修改

This commit is contained in:
he
2025-09-29 10:21:44 +08:00
parent 1095e07f87
commit a713ffdc61
2 changed files with 6 additions and 33 deletions
@@ -588,39 +588,6 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
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();
}