package com.wms_main.model.vo.wms;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.wms_main.model.po.TSysUser;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 用户Vo
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserVo {
    /**
     * 登录账户
     */
    @JsonProperty("loginAccount")
    private String loginAccount;
    /**
     * 用户名
     */
    @JsonProperty("userName")
    private String userName;
    /**
     * 角色Id
     */
    @JsonProperty("roleId")
    private String roleId;

    /**
     * 从po转化为vo
     * @param userPo po
     * @return vo
     */
    public static UserVo ofPo(TSysUser userPo) {
        UserVo userVo = new UserVo();
        userVo.setLoginAccount(userPo.getLoginAccount());
        userVo.setUserName(userPo.getUserName());
        userVo.setRoleId(userPo.getRoleId());
        return userVo;
    }
}
