🎉 2.4.0.RELEASE

This commit is contained in:
smallchill 2019-08-04 23:28:03 +08:00
parent e1f3b0c054
commit f649d2b3ce
10 changed files with 38 additions and 38 deletions

View File

@ -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())
);
}
}

View File

@ -36,7 +36,7 @@ public class BladeTenantProperties {
/**
* 多租户字段名称
*/
private String column = "tenant_code";
private String column = "tenant_id";
/**
* 多租户数据表

View File

@ -23,8 +23,8 @@ package org.springblade.core.boot.tenant;
public interface TenantConstant {
/**
* 默认租户编号
* 默认租户ID
*/
String DEFAULT_TENANT_CODE = "000000";
String DEFAULT_TENANT_ID = "000000";
}

View File

@ -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

View File

@ -93,7 +93,7 @@ public class BladeCodeGenerator {
/**
* 租户字段
*/
private String tenantColumn = "tenant_code";
private String tenantColumn = "tenant_id";
/**
* 是否启用swagger
*/

View File

@ -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";

View File

@ -28,9 +28,9 @@ import lombok.Data;
public class TenantEntity extends BaseEntity {
/**
* 租户编号
* 租户ID
*/
@ApiModelProperty(value = "租户编号")
private String tenantCode;
@ApiModelProperty(value = "租户ID")
private String tenantId;
}

View File

@ -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;
/**
* 昵称
*/

View File

@ -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);

View File

@ -66,9 +66,9 @@ public interface BladeConstant {
int DB_ADMIN_LOCKED = 1;
/**
* 管理员对应的租户编号
* 管理员对应的租户ID
*/
String ADMIN_TENANT_CODE = "000000";
String ADMIN_TENANT_ID = "000000";
/**
* 日志默认状态