diff --git a/APT.MicroApi/APT.SK.WebApi/Controllers/Api/SecurityInspectionNoticeController.cs b/APT.MicroApi/APT.SK.WebApi/Controllers/Api/SecurityInspectionNoticeController.cs index 5b62fa9..fe013fc 100644 --- a/APT.MicroApi/APT.SK.WebApi/Controllers/Api/SecurityInspectionNoticeController.cs +++ b/APT.MicroApi/APT.SK.WebApi/Controllers/Api/SecurityInspectionNoticeController.cs @@ -3094,6 +3094,44 @@ namespace APT.SK.WebApi.Controllers.Api result.Add(refRecordLog); } #endregion + } + /// + /// 根据主键删除数据 + /// + /// 主键ID + /// + [HttpGet, Route("FullDelete")] + public JsonActionResult FullDelete(string id) + { + return SafeExecute(() => + { + if (string.IsNullOrEmpty(id)) + this.ThrowError("060010"); + var approves = new List(); + var tasks = new List(); + var notices = new List(); + var notice = this.GetEntity(id); + if (notice != null) + { + notice.IS_DELETED = true; + notices.Add(notice); + approves = this.GetEntities(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 => 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; + }); } } }