refactor(tenant): 优化租户相关代码

This commit is contained in:
2025-07-17 22:15:13 +08:00
parent 6e7d371565
commit 7e9a950694
29 changed files with 333 additions and 151 deletions

View File

@@ -0,0 +1,43 @@
/*
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
*
* Licensed 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 top.continew.admin.common.base.model.entity;
import lombok.Data;
import java.io.Serial;
/**
* 租户实体类基类
*
* <p>
* 通用字段ID、创建人、创建时间、修改人、修改时间、租户 ID
* </p>
*
* @author Charles7c
* @since 2025/7/17 20:20
*/
@Data
public class TenantBaseDO extends BaseDO {
@Serial
private static final long serialVersionUID = 1L;
/**
* 租户 ID
*/
private Long tenantId;
}

View File

@@ -35,6 +35,16 @@ import java.util.List;
@ConfigurationProperties(prefix = PropertiesConstants.TENANT)
public class TenantExtensionProperties {
/**
* 是否启用
*/
private boolean enabled;
/**
* 请求头中租户编码键名
*/
private String tenantCodeHeader;
/**
* 忽略菜单 ID租户不能使用的菜单
*/

View File

@@ -60,10 +60,22 @@ public class RegexConstants {
public static final String PACKAGE_NAME = "^(?:[a-zA-Z_][a-zA-Z0-9_]*\\.)*[a-zA-Z_][a-zA-Z0-9_]*$";
/**
* HTTP 域名 URL 正则
* HTTP 域名 URL 正则(非 IP 地址)
*/
public static final String HTTP_DOMAIN_URL = "^(https?:\\/\\/)([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}(\\/[^\\s]*)?$";
/**
* HTTP HOST 正则
* <p>
* 域名、IPV4、IPV6
* </p>
*/
public static final String HTTP_HOST = """
^((?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|
(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|
(?:(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|
""";
private RegexConstants() {
}
}