package cn.com.ty.lift.system.user.dao.entity;

import cn.com.ty.lift.common.constants.CommonEnum;
import cn.com.ty.lift.system.user.dao.entity.model.RoleRequest;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import java.util.Date;

/**
 * 实体类 - 表：role
 * @since 2019-12-01 16:52:41
 */
@Data
public class Role {
	@TableId(value = "id", type = IdType.ID_WORKER)
	private Long id;

	private String name;

	private String code;

	private String description;

	private Long companyId;

	private Date createTime;

	private Date updateTime;

	private Long createUserId;

	private Long updateUserId;

	private Integer deleteFlag;

	public Role(){}

	public Role(RoleRequest roleRequest){
		this.id = roleRequest.getId();
		this.name = roleRequest.getName();
		this.description = roleRequest.getDescription();
		this.createUserId = roleRequest.getUserId();
		this.companyId = roleRequest.getCompanyId();
	}

    public Role(CommonEnum.DefaultRole defaultRole) {
		this.code = defaultRole.getCode();
		this.name = defaultRole.getLabel();
    }
}