diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantHandler.java b/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantHandler.java index 6d3c2e1..dea58f0 100644 --- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantHandler.java +++ b/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantHandler.java @@ -36,13 +36,13 @@ public class BladeTenantHandler implements TenantHandler { private final BladeTenantProperties properties; /** - * 获取租户编号 + * 获取租户ID * - * @return 租户编号 + * @return 租户ID */ @Override public Expression getTenantId() { - return new StringValue(Func.toStr(SecureUtil.getTenantCode(), TenantConstant.DEFAULT_TENANT_CODE)); + return new StringValue(Func.toStr(SecureUtil.getTenantId(), TenantConstant.DEFAULT_TENANT_ID)); } /** @@ -68,7 +68,7 @@ public class BladeTenantHandler implements TenantHandler { (properties.getTables().size() > 0 && properties.getTables().contains(tableName)) || properties.getBladeTables().contains(tableName) ) - && StringUtil.isNotBlank(SecureUtil.getTenantCode()) + && StringUtil.isNotBlank(SecureUtil.getTenantId()) ); } } diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantProperties.java b/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantProperties.java index 0ce0d57..9426372 100644 --- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantProperties.java +++ b/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantProperties.java @@ -36,7 +36,7 @@ public class BladeTenantProperties { /** * 多租户字段名称 */ - private String column = "tenant_code"; + private String column = "tenant_id"; /** * 多租户数据表 diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConstant.java b/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConstant.java index 9b6b4ef..fa4fc56 100644 --- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConstant.java +++ b/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConstant.java @@ -23,8 +23,8 @@ package org.springblade.core.boot.tenant; public interface TenantConstant { /** - * 默认租户编号 + * 默认租户ID */ - String DEFAULT_TENANT_CODE = "000000"; + String DEFAULT_TENANT_ID = "000000"; } diff --git a/blade-core-boot/src/main/resources/bootstrap.yml b/blade-core-boot/src/main/resources/bootstrap.yml index 37ce43d..fb2e8d3 100644 --- a/blade-core-boot/src/main/resources/bootstrap.yml +++ b/blade-core-boot/src/main/resources/bootstrap.yml @@ -51,21 +51,21 @@ mybatis-plus: typeAliasesPackage: org.springblade.**.entity #typeEnumsPackage: org.springblade.dashboard.entity.enums global-config: - #刷新mapper 调试神器 - refresh: ${blade.dev-mode} # 关闭MP3.0自带的banner banner: false db-config: - #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; - id-type: 0 - #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断" - field-strategy: 2 + #主键类型 0:"数据库ID自增", 1:"不操作", 2:"用户输入ID",3:"数字型snowflake", 4:"全局唯一ID UUID", 5:"字符串型snowflake"; + id-type: id_worker + #字段策略 + insert-strategy: not_null + update-strategy: not_null + select-strategy: not_null #驼峰下划线转换 - column-underline: true + table-underline: true # 逻辑删除配置 - # 逻辑删除全局值(1表示已删除,Mybatis Plus的默认配置) + # 逻辑删除全局值(1表示已删除,这也是Mybatis Plus的默认配置) logic-delete-value: 1 - # 逻辑未删除全局值(0表示未删除,Mybatis Plus的默认配置) + # 逻辑未删除全局值(0表示未删除,这也是Mybatis Plus的默认配置) logic-not-delete-value: 0 configuration: map-underscore-to-camel-case: true diff --git a/blade-core-develop/src/main/java/org/springblade/develop/support/BladeCodeGenerator.java b/blade-core-develop/src/main/java/org/springblade/develop/support/BladeCodeGenerator.java index 1b15266..83de2ca 100644 --- a/blade-core-develop/src/main/java/org/springblade/develop/support/BladeCodeGenerator.java +++ b/blade-core-develop/src/main/java/org/springblade/develop/support/BladeCodeGenerator.java @@ -93,7 +93,7 @@ public class BladeCodeGenerator { /** * 租户字段 */ - private String tenantColumn = "tenant_code"; + private String tenantColumn = "tenant_id"; /** * 是否启用swagger */ diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/TokenConstant.java b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/TokenConstant.java index b5c86f3..94a40e9 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/TokenConstant.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/TokenConstant.java @@ -35,7 +35,7 @@ public interface TokenConstant { String ROLE_ID = "role_id"; String USER_NAME = "user_name"; String ROLE_NAME = "role_name"; - String TENANT_CODE = "tenant_code"; + String TENANT_ID = "tenant_id"; String CLIENT_ID = "client_id"; String LICENSE = "license"; String LICENSE_NAME = "powered by blade"; diff --git a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/TenantEntity.java b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/TenantEntity.java index 587fbab..04f5946 100644 --- a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/TenantEntity.java +++ b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/TenantEntity.java @@ -28,9 +28,9 @@ import lombok.Data; public class TenantEntity extends BaseEntity { /** - * 租户编号 + * 租户ID */ - @ApiModelProperty(value = "租户编号") - private String tenantCode; + @ApiModelProperty(value = "租户ID") + private String tenantId; } diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/BladeUser.java b/blade-core-secure/src/main/java/org/springblade/core/secure/BladeUser.java index 2710976..43d94b6 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/BladeUser.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/BladeUser.java @@ -41,10 +41,10 @@ public class BladeUser implements Serializable { @ApiModelProperty(hidden = true) private Integer userId; /** - * 租户编号 + * 租户ID */ @ApiModelProperty(hidden = true) - private String tenantCode; + private String tenantId; /** * 昵称 */ diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java b/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java index dd61e7b..47c066c 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java @@ -49,7 +49,7 @@ public class SecureUtil { private final static String ROLE_ID = TokenConstant.ROLE_ID; private final static String USER_NAME = TokenConstant.USER_NAME; private final static String ROLE_NAME = TokenConstant.ROLE_NAME; - private final static String TENANT_CODE = TokenConstant.TENANT_CODE; + private final static String TENANT_ID = TokenConstant.TENANT_ID; private final static String CLIENT_ID = TokenConstant.CLIENT_ID; private final static Integer AUTH_LENGTH = TokenConstant.AUTH_LENGTH; private static String BASE64_SECURITY = Base64.getEncoder().encodeToString(TokenConstant.SIGN_KEY.getBytes(Charsets.UTF_8)); @@ -95,7 +95,7 @@ public class SecureUtil { } String clientId = Func.toStr(claims.get(SecureUtil.CLIENT_ID)); Integer userId = Func.toInt(claims.get(SecureUtil.USER_ID)); - String tenantCode = Func.toStr(claims.get(SecureUtil.TENANT_CODE)); + String tenantId = Func.toStr(claims.get(SecureUtil.TENANT_ID)); String roleId = Func.toStr(claims.get(SecureUtil.ROLE_ID)); String account = Func.toStr(claims.get(SecureUtil.ACCOUNT)); String roleName = Func.toStr(claims.get(SecureUtil.ROLE_NAME)); @@ -103,7 +103,7 @@ public class SecureUtil { BladeUser bladeUser = new BladeUser(); bladeUser.setClientId(clientId); bladeUser.setUserId(userId); - bladeUser.setTenantCode(tenantCode); + bladeUser.setTenantId(tenantId); bladeUser.setAccount(account); bladeUser.setRoleId(roleId); bladeUser.setRoleName(roleName); @@ -197,30 +197,30 @@ public class SecureUtil { } /** - * 获取租户编号 + * 获取租户ID * - * @return tenantCode + * @return tenantId */ - public static String getTenantCode() { + public static String getTenantId() { BladeUser user = getUser(); - return (null == user) ? StringPool.EMPTY : user.getTenantCode(); + return (null == user) ? StringPool.EMPTY : user.getTenantId(); } /** - * 获取租户编号 + * 获取租户ID * * @param request request - * @return tenantCode + * @return tenantId */ - public static String getTenantCode(HttpServletRequest request) { + public static String getTenantId(HttpServletRequest request) { BladeUser user = getUser(request); - return (null == user) ? StringPool.EMPTY : user.getTenantCode(); + return (null == user) ? StringPool.EMPTY : user.getTenantId(); } /** * 获取客户端id * - * @return tenantCode + * @return tenantId */ public static String getClientId() { BladeUser user = getUser(); @@ -231,7 +231,7 @@ public class SecureUtil { * 获取客户端id * * @param request request - * @return tenantCode + * @return tenantId */ public static String getClientId(HttpServletRequest request) { BladeUser user = getUser(request); diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/constant/BladeConstant.java b/blade-core-tool/src/main/java/org/springblade/core/tool/constant/BladeConstant.java index 87f8f2f..13e957c 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/constant/BladeConstant.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/constant/BladeConstant.java @@ -66,9 +66,9 @@ public interface BladeConstant { int DB_ADMIN_LOCKED = 1; /** - * 管理员对应的租户编号 + * 管理员对应的租户ID */ - String ADMIN_TENANT_CODE = "000000"; + String ADMIN_TENANT_ID = "000000"; /** * 日志默认状态