Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running Details

Test_IRC_Net8
hang 2025-09-29 10:30:10 +08:00
commit 9545e699c2
2 changed files with 6 additions and 33 deletions

View File

@ -601,39 +601,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();
}

View File

@ -106,9 +106,15 @@ namespace IRaCIS.Core.Domain.Models
public AuditDocument Descendant { get; set; }
/// <summary>
/// 父Id
/// </summary>
[Comment("祖先")]
public Guid AncestorId { get; set; }
/// <summary>
/// 子Id
/// </summary>
[Comment("后代")]
public Guid DescendantId { get; set; }
public int Depth { get; set; } // 0=自己, 1=直接子节点, 2=孙节点...