package com.iformall.domain.po.base;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author Stormeye
 * @date 2019/4/24 14:32
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class BaseTenantEntity extends BaseEntity {
    @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
    private String tenantId;

    @TableField(exist = false)
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private TenantEntity tenantInfo;

    public void updateTenantInfo(TenantEntity info) {
        setTenantId(info.getTenantId());
    }

    public void updateTenantInfo(BaseTenantEntity info) {
        setTenantId(info.getTenantId());
    }

    public TenantEntity getTenantInfo() {
        return new TenantEntity() {{
            setTenantId(tenantId);
        }};
    }
}
