fix 实体校验调整

This commit is contained in:
2024-09-11 14:19:23 +08:00
parent 57ec12a1d3
commit 1b9591936e

View File

@@ -53,7 +53,6 @@ public class AppointmentReceiveItemDto : IValidatableObject
/// <summary>
/// 预约门岗区域
/// </summary>
[Required(ErrorMessage = "预约门岗区域不可为空")]
public string ApplyDoorArea { get; set; }
/// <summary>
@@ -89,9 +88,17 @@ public class AppointmentReceiveItemDto : IValidatableObject
/// <inheritdoc />
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (DoorStart >= DoorEnd)
if (IsEnterDoorArea)
{
yield return new ValidationResult($"{Name}门禁来访时间有误", new[] { nameof(DoorStart) });
if (ApplyDoorArea.IsEmpty())
{
yield return new ValidationResult($"{Name}门岗区域不可为空", new[] { nameof(ApplyWorkplaceAreas) });
}
if (DoorStart >= DoorEnd)
{
yield return new ValidationResult($"{Name}门禁来访时间有误", new[] { nameof(DoorStart) });
}
}
if (IsEnterWorkplace)