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