public void DeleteForm(string keyValue) { if (service.IQueryable().Count(t => t.ParentId.Equals(keyValue)) > 0) { throw new Exception("删除失败!操作的对象包含了下级数据。"); } else { service.DeleteById(t => t.Id == keyValue); } //添加日志 LogHelp.logHelp.WriteDbLog(true, "删除机构信息=>" + keyValue, Enums.DbLogType.Delete, "机构管理"); }