using System.ComponentModel; using System.ComponentModel.DataAnnotations; using DS.Module.Core.Extensions; using FluentValidation; using SqlSugar; namespace DS.WMS.Core.Sys.Dtos; /// /// 用户编辑实体 /// public class UserReq { /// /// /// public long Id { get; set; } /// /// /// 登陆账号 /// public string UserCode { get; set; } /// /// 员工代码 /// [Description("员工代码")] public string UserNumber { 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 Avatar { get; set; } = ""; /// /// /// public DateTime? Birthday { get; set; } = DateTime.MinValue; /// /// 手机号码 /// public string Phone { get; set; } = ""; /// /// 邮箱 /// public string Email { get; set; } = ""; /// /// 电话 /// public string Tel { get; set; } /// /// 办公电话 /// public string OfficePhone { get; set; } /// /// 传真 /// public string Fax { get; set; } /// /// 财务软件代码 /// public string FinanceSoftCode { 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 bool IsOperator { get; set; } = false; /// /// 是否单证 /// public bool IsVouchingClerk { get; set; } = false; /// /// 是否销售 /// public bool IsSale { get; set; } = false; /// /// 是否报关员 /// public bool IsCustom { get; set; } = false; /// /// 是否财务 /// public bool IsFinancialStaff { get; set; } = false; /// /// 是否客服 /// public bool IsCustomerService { get; set; } = false; /// /// 是否司机 /// public bool IsDriver { get; set; } = false; /// /// 是否派车调度人员 /// public bool IsDispatcher { get; set; } = false; /// /// 默认部门Id /// public long DeptId { get; set; } = 0; /// /// 默认机构Id /// public long DefaultOrgId { get; set; } = 0; /// /// 英文名称 /// [Description("英文名称")] public string UserEnName { get; set; } /// /// 是否航线操作人员 /// public bool IsLaner { get; set; } = false; /// /// 签名图片 /// public string SignatureUrl { get; set; } = ""; /// /// 邮件签名 /// public string SignatureHtml { get; set; } = ""; /// /// 默认机构 /// public string DefaultOrgName { get; set; } = ""; /// /// 默认部门 /// public string DeptName { get; set; } = ""; /// /// 首页地址 /// public string? HomePath { get; set; } /// /// 是否允许使用本系统 /// public bool IsUseSystem { get; set; } = false; /// /// 身份证号 /// [Description("身份证号")] public string IdCardNo { get; set; } /// /// QQ /// [Description("QQ")] public string QQ { get; set; } /// /// Desc:业务来源Id /// public long? SourceId { get; set; } /// /// Desc:业务来源明细Id /// public long? SourceDetailId { get; set; } /// /// Desc:业务来源代码 /// public string SourceCode { get; set; } /// /// Desc:业务来源名称 /// public string SourceName { get; set; } /// /// Desc:业务来源明细名称 /// public string SourceDetailName { 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.Phone) .NotEmpty().WithName("手机号码"); this.RuleFor(o => o.Email) .NotEmpty().WithName("邮箱"); this.RuleFor(o => o.Password) .NotEmpty().WithName("密码"); } }