Compare commits
No commits in common. "0a8573091e085453881df49f0bca0c7ee60b23e4" and "406235cc03d3688d0f918698b89ceb10ba34b7f0" have entirely different histories.
0a8573091e
...
406235cc03
|
|
@ -601,6 +601,39 @@ 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,15 +106,9 @@ 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