修复相关bug
This commit is contained in:
+10
-8
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user