using System.ComponentModel.DataAnnotations;
using DS.Module.Core.Extensions;
using FluentValidation;
namespace DS.WMS.Core.System.Dtos;
///
/// 用户编辑实体
///
public class UserReq
{
///
///
///
public long Id { get; set; }
///
///
/// 登陆账号
///
public string UserCode { get; set; }
///
/// 密码
///
[RegularExpression(pattern:@"^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,}$",ErrorMessage ="密码至少要包含8个字符,同时包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符")]
public string Password { get; set; }
///
///姓名
///
public string UserName { get; set; }
///
/// 性别 1-男 2-女 3 -未知
///
public int Sex { get; set; } = 1;
///
///
///
public string NickName { get; set; } = "";
///
///
///
public string Avatar { get; set; } = "";
///
///
///
public DateTime? Birthday { get; set; } = DateTime.MinValue;
///
/// 电话
///
public string Phone { get; set; } = "";
///
/// 邮箱
///
public string Email { get; set; } = "";
///
/// 职位
///
public string Duty { get; set; } = "";
///
/// 用户类型 1-管理员 2-普通用户
///
public int UserType { get; set; } = 1;
///
/// 权限身份 0: 无; 1:客户端; 2:市平台:3:省平台
///
public int PermissionIdentity { get; set; }
///
/// 备注
///
public string Note { get; set; } = "";
///
/// 用戶角色
///
public long?[] RoleIds { get; set; }
///
/// 用戶机构
///
public long?[] OrgIds { get; set; }
}
///
/// 验证
///
public class UserInputValidator : AbstractValidator
{
///
/// 构造函数
///
public UserInputValidator()
{
this.RuleFor(o => o.UserCode)
.NotEmpty().WithName("登录账号");
this.RuleFor(o => o.UserName)
.NotEmpty().WithName("用户名称");
this.RuleFor(o => o.Password)
.NotEmpty().WithName("密码");
}
}