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
{
///
/// 档案类型
///
[EnumDataType(typeof(GainfoStatusEnumType))]
public GainfoStatusEnumType? Status { get; set; } = GainfoStatusEnumType.Working;
///
/// 部门选择
///
public List DepartmentSelections { get; set; } = new();
///
/// 查询类型 GainfoSearchEnumType
///
[EnumDataType(typeof(GainfoSearchEnumType))]
public GainfoSearchEnumType? SearchType { get; set; }
///
/// 无条件查询所有
///
public bool IsSearchAll { get; set; }
public IEnumerable Validate(ValidationContext validationContext)
{
DepartmentSelections.ForEach(d =>
{
//存在
if (d.DepartmentNos.IsPresent())
{
d.DepartmentNos.Remove(d.Tenant);
}
});
if (SearchType == GainfoSearchEnumType.BusinessTrip)
{
SearchType = null;
}
yield break;
}
}