package com.yonge.cooleshow.biz.dal.vo;

import com.yonge.cooleshow.auth.api.entity.SysUser;
import com.yonge.cooleshow.biz.dal.entity.Employee;
import com.yonge.cooleshow.biz.dal.enums.GenderEnum;
import com.yonge.cooleshow.biz.dal.enums.UserLockFlag;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.beanutils.BeanUtils;

import java.util.List;

/**
 * @Author: liweifan
 * @Data: 2022-04-06 16:04:57
 */
@ApiModel(value = "EmployeeVo对象", description = "员工表查询视图对象")
public class EmployeeVo extends Employee {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty("昵称")
    private String username;
    @ApiModelProperty(value = "性别 0女 1男")
    private GenderEnum gender;
    @ApiModelProperty(value = "手机号")
    private String phone;
    @ApiModelProperty(value = "头像")
    private String avatar;
    @ApiModelProperty(value = "0-正常，9-锁定")
    private UserLockFlag lockFlag;
    @ApiModelProperty(value = "角色id列表")
    private List<Long> roleIds;
    @ApiModelProperty(value = "用户对象")
    private SysUser sysUser;
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public GenderEnum getGender() {
        return gender;
    }

    public void setGender(GenderEnum gender) {
        this.gender = gender;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public UserLockFlag getLockFlag() {
        return lockFlag;
    }

    public void setLockFlag(UserLockFlag lockFlag) {
        this.lockFlag = lockFlag;
    }

    public List<Long> getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(List<Long> roleIds) {
        this.roleIds = roleIds;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public SysUser getSysUser() {
        return sysUser;
    }

    public void setSysUser(SysUser sysUser) {
        this.sysUser = sysUser;
    }

    public EmployeeVo buildVo(Employee employee) {
        if(null == employee){
            return new EmployeeVo();
        }
        try {
            BeanUtils.copyProperties(this, employee);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return this;
    }
}