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

import com.simuwang.base.common.support.command.BaseEditCmd;
import com.simuwang.base.pojo.dos.sys.SysUserDO;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;

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

    private Integer status;

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