package com.microservices.system.domain.vo;

import com.microservices.common.core.utils.bean.BeanUtils;
import com.microservices.system.api.domain.SysRole;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;

/**
 * @author otto
 */
@Data
@ApiModel("角色更新对象")
public class SysRoleUpdateVo {
    @ApiModelProperty(value = "角色Id", hidden = true)
    private Long roleId;
    @ApiModelProperty(value = "角色名称")
    private String roleName;
    @ApiModelProperty(value = "角色排序")
    private Integer roleSort;
    @ApiModelProperty(value = "菜单组")
    @NotNull
    private Long[] menuIds;
    @ApiModelProperty(value = "备注")
    private String remark;

    public SysRole toSysRole(Long roleId) {
        SysRole target = new SysRole();
        BeanUtils.copyProperties(this, target);
        target.setRoleId(roleId);
        return target;
    }
}
