You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
3.6 KiB
C#

10 months ago
using System.ComponentModel.DataAnnotations;
using DS.Module.Core.Extensions;
12 months ago
using FluentValidation;
namespace DS.WMS.Core.Sys.Dtos;
12 months ago
/// <summary>
/// 用户编辑实体
/// </summary>
11 months ago
public class UserReq
12 months ago
{
/// <summary>
///
/// </summary>
11 months ago
public long Id { get; set; }
12 months ago
/// <summary>
/// <summary>
/// 登陆账号
/// </summary>
public string UserCode { get; set; }
/// <summary>
/// 密码
/// </summary>
10 months ago
[RegularExpression(pattern:@"^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,}$",ErrorMessage ="8")]
12 months ago
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>
11 months ago
public long?[] RoleIds { get; set; }
10 months ago
/// <summary>
/// 用戶机构
/// </summary>
public long?[] OrgIds { get; set; }
8 months ago
/// <summary>
/// 是否操作
/// </summary>
public bool IsOperator { get; set; } = false;
/// <summary>
/// 是否单证
/// </summary>
public bool IsVouchingClerk { get; set; } = false;
/// <summary>
/// 是否销售
/// </summary>
public bool IsSale { get; set; } = false;
/// <summary>
/// 是否报关员
/// </summary>
public bool IsCustom { get; set; } = false;
/// <summary>
/// 是否财务
/// </summary>
public bool IsFinancialStaff { get; set; } = false;
/// <summary>
/// 是否客服
/// </summary>
public bool IsCustomerService { get; set; } = false;
/// <summary>
/// 是否司机
/// </summary>
public bool IsDriver { get; set; } = false;
/// <summary>
/// 是否派车调度人员
/// </summary>
public bool IsDispatcher { get; set; } = false;
/// <summary>
/// 默认部门Id
/// </summary>
public long DeptId { get; set; } = 0;
/// <summary>
/// 默认机构Id
/// </summary>
public long DefaultOrgId { get; set; } = 0;
12 months ago
}
/// <summary>
/// 验证
/// </summary>
11 months ago
public class UserInputValidator : AbstractValidator<UserReq>
12 months ago
{
/// <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("密码");
}
}