package com.simuwang.base.pojo.dto.sys;

import com.simuwang.base.common.support.command.BaseAddCmd;
import com.simuwang.base.pojo.dos.sys.SysUserDO;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;

/**
 * @author wangzaijun
 * @date 2024/9/13 17:26
 * @description 新增用户的接口请求参数
 */
@Setter
@Getter
public class UserAddCmd extends BaseAddCmd<SysUserDO> {
    /**
     * 用户名称
     */
    @NotBlank(message = "用户名不能为空")
    private String userName;
    /**
     * 用户邮箱
     */
    @Email
    private String email;
    /**
     * 手机号码
     */
    private String phonenumber;
    /**
     * 密码在后端加密
     */
    private String password;

    private Integer status;

    private String remark;

    @Override
    public SysUserDO toEntity() {
        SysUserDO entity = new SysUserDO();
        entity.setUserName(this.userName);
        entity.setEmail(this.email);
        entity.setPhonenumber(this.phonenumber);
        entity.setStatus(this.status);
        entity.setRemark(this.remark);
        // 密码要加密才OK
        return entity;
    }
}
