修复相关bug

This commit is contained in:
fuenmao
2026-09-14 15:59:37 +08:00
parent 20409635d6
commit f004aec10f
9 changed files with 230 additions and 29 deletions
@@ -112,12 +112,11 @@ public class OnboardingEntryConfigService : IOnboardingEntryConfigService
OnboardingPermissionCodes.EntryConfigManageAll,
"入职字段");
var isReferenced = await _db.Queryable<ObFormRequirement>()
var isReferencedByTask = await _db.Queryable<ObTaskFormRequirement>()
.AnyAsync(x => input.Ids.Contains(x.FieldId));
var isReferencedByTemplate = await _db.Queryable<ObOnboardingTemplateFormField>()
.AnyAsync(x => input.Ids.Contains(x.FieldId));
if (isReferenced || isReferencedByTemplate)
throw Oops.Bah("字段已被入职模板引用,不能删除");
if (isReferencedByTask)
throw Oops.Bah("字段已被入职任务引用,不能删除,可改为停用");
await _db.Deleteable<ObFormField>().In(input.Ids).ExecuteCommandAsync();
}
@@ -196,13 +195,16 @@ public class OnboardingEntryConfigService : IOnboardingEntryConfigService
OnboardingPermissionCodes.EntryConfigManageAll,
"资料类型");
var isReferenced = await _db.Queryable<ObMaterialRequirement>()
.AnyAsync(x => input.Ids.Contains(x.MaterialTypeId));
var isReferencedByTemplate = await _db.Queryable<ObOnboardingTemplateMaterial>()
.AnyAsync(x => input.Ids.Contains(x.MaterialTypeId));
if (isReferenced || isReferencedByTemplate)
if (isReferencedByTemplate)
throw Oops.Bah("资料类型已被入职模板引用,不能删除");
var isReferencedByTask = await _db.Queryable<ObTaskMaterialRequirement>()
.AnyAsync(x => input.Ids.Contains(x.MaterialTypeId));
if (isReferencedByTask)
throw Oops.Bah("资料类型已被入职任务引用,不能删除,可改为停用");
var hasUploads = await _db.Queryable<ObTaskMaterial>()
.AnyAsync(x => input.Ids.Contains(x.MaterialTypeId));
if (hasUploads)