Files
jinko.yikatong/Src/Dlhis.Basic/Organization/Request/GainfoPageRequest.cs
2025-01-08 16:15:08 +08:00

51 lines
1.3 KiB
C#

using Dlhis.Entity.Basic.Enums;
using Kurisu.AspNetCore.Utils.Extensions;
using System.ComponentModel.DataAnnotations;
using Kurisu.AspNetCore.DataAccess.Dto;
namespace Dlhis.Basic.Organization.Request;
public class GainfoPageRequest : PageDto, IValidatableObject
{
/// <summary>
/// 档案类型
/// </summary>
[EnumDataType(typeof(GainfoStatusEnumType))]
public GainfoStatusEnumType? Status { get; set; } = GainfoStatusEnumType.Working;
/// <summary>
/// 部门选择
/// </summary>
public List<TenantDepartmentRequest> DepartmentSelections { get; set; } = new();
/// <summary>
/// 查询类型 GainfoSearchEnumType
/// </summary>
[EnumDataType(typeof(GainfoSearchEnumType))]
public GainfoSearchEnumType? SearchType { get; set; }
/// <summary>
/// 无条件查询所有
/// </summary>
public bool IsSearchAll { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
DepartmentSelections.ForEach(d =>
{
//存在
if (d.DepartmentNos.IsPresent())
{
d.DepartmentNos.Remove(d.Tenant);
}
});
if (SearchType == GainfoSearchEnumType.BusinessTrip)
{
SearchType = null;
}
yield break;
}
}