content: /*
   * Licensed to the Apache Software Foundation (ASF) under one or more
   * contributor license agreements.  See the NOTICE file distributed with
   * this work for additional information regarding copyright ownership.
   * The ASF licenses this file to You under the Apache License, Version 2.0
   * (the "License"); you may not use this file except in compliance with
   * the License.  You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package com.alipay.application.service.system.domain;
  
  import com.alipay.application.service.system.domain.enums.Status;
  import com.alipay.common.constant.TenantConstants;
  import lombok.Getter;
  import lombok.Setter;
  
  import java.util.Date;
  
  @Getter
  @Setter
  public class Tenant {
  
      private static final long serialVersionUID = 1L;
  
  
      private Long id;
  
      private Date gmtCreate;
  
      private Date gmtModified;
  
      private String tenantName;
  
      private String roleName;
  
      private Status status;
  
      private String tenantDesc;
  
  
      public Tenant(Long id, String tenantName, Status status, String tenantDesc) {
          this.id = id;
          this.tenantName = tenantName;
          this.status = status;
          this.tenantDesc = tenantDesc;
      }
  
      public Tenant() {
  
      }
  
      /**
       * 创建默认租户
       *
       * @return Tenant
       */
      public static Tenant createDefaultTenant() {
          Tenant tenant = new Tenant();
          tenant.setTenantName(TenantConstants.DEFAULT_TENANT);
          tenant.setStatus(Status.valid);
          tenant.setTenantDesc(TenantConstants.DEFAULT_TENANT_DESC);
          return tenant;
      }
  
      /**
       * 创建全局租户
       *
       * @return Tenant
       */
      public static Tenant createGlobalTenant() {
          Tenant tenant = new Tenant();
          tenant.setTenantName(TenantConstants.GLOBAL_TENANT);
          tenant.setStatus(Status.valid);
          tenant.setTenantDesc(TenantConstants.GLOBAL_TENANT);
          return tenant;
      }
  
      /**
       * 是否是全局租户
       *
       * @return boolean
       */
      public boolean isGlobalTenant() {
          return TenantConstants.GLOBAL_TENANT.equals(tenantName);
      }
  }