This commit is contained in:
wyw 2026-04-27 11:42:05 +08:00
commit 564cf0dfc6

View File

@ -3094,6 +3094,44 @@ namespace APT.SK.WebApi.Controllers.Api
result.Add(refRecordLog);
}
#endregion
}
/// <summary>
/// 根据主键删除数据
/// </summary>
/// <param name="id">主键ID</param>
/// <returns></returns>
[HttpGet, Route("FullDelete")]
public JsonActionResult<bool> FullDelete(string id)
{
return SafeExecute(() =>
{
if (string.IsNullOrEmpty(id))
this.ThrowError("060010");
var approves = new List<T_PF_APPROVE>();
var tasks = new List<T_FM_NOTIFICATION_TASK>();
var notices = new List<T_SK_SECURITY_INSPECTION_NOTICE>();
var notice = this.GetEntity<T_SK_SECURITY_INSPECTION_NOTICE>(id);
if (notice != null)
{
notice.IS_DELETED = true;
notices.Add(notice);
approves = this.GetEntities<T_PF_APPROVE>(t => t.DATA_ID != null && t.DATA_ID == notice.ID, new BaseFilter(notice.ORG_ID)).ToList();
approves.ForEach(t => t.IS_DELETED = true);
var approveIds = approves.Select(t => t.ID).ToList();
tasks = this.GetEntities<T_FM_NOTIFICATION_TASK>(t => t.SOURCE_DATA_ID != null && (t.SOURCE_DATA_ID == notice.ID || approveIds.Contains((Guid)t.SOURCE_DATA_ID)), new BaseFilter(notice.ORG_ID)).ToList();
tasks.ForEach(t => t.IS_DELETED = true);
}
UnifiedCommit(() =>
{
if (notices != null && notices.Any())
this.BantchUpdateEntity_noneBase(notices);
if (approves != null && approves.Any())
this.BantchUpdateEntity_noneBase(approves);
if (tasks != null && tasks.Any())
this.BantchUpdateEntity_noneBase(tasks);
});
return true;
});
}
}
}