mirror of
https://github.com/chillzhuang/blade-tool
synced 2024-12-12 12:19:27 +08:00
🎉 2.4.0.RELEASE
This commit is contained in:
parent
e1f3b0c054
commit
f649d2b3ce
@ -36,13 +36,13 @@ public class BladeTenantHandler implements TenantHandler {
|
|||||||
private final BladeTenantProperties properties;
|
private final BladeTenantProperties properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取租户编号
|
* 获取租户ID
|
||||||
*
|
*
|
||||||
* @return 租户编号
|
* @return 租户ID
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Expression getTenantId() {
|
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.getTables().size() > 0 && properties.getTables().contains(tableName))
|
||||||
|| properties.getBladeTables().contains(tableName)
|
|| properties.getBladeTables().contains(tableName)
|
||||||
)
|
)
|
||||||
&& StringUtil.isNotBlank(SecureUtil.getTenantCode())
|
&& StringUtil.isNotBlank(SecureUtil.getTenantId())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class BladeTenantProperties {
|
|||||||
/**
|
/**
|
||||||
* 多租户字段名称
|
* 多租户字段名称
|
||||||
*/
|
*/
|
||||||
private String column = "tenant_code";
|
private String column = "tenant_id";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多租户数据表
|
* 多租户数据表
|
||||||
|
@ -23,8 +23,8 @@ package org.springblade.core.boot.tenant;
|
|||||||
public interface TenantConstant {
|
public interface TenantConstant {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认租户编号
|
* 默认租户ID
|
||||||
*/
|
*/
|
||||||
String DEFAULT_TENANT_CODE = "000000";
|
String DEFAULT_TENANT_ID = "000000";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,21 +51,21 @@ mybatis-plus:
|
|||||||
typeAliasesPackage: org.springblade.**.entity
|
typeAliasesPackage: org.springblade.**.entity
|
||||||
#typeEnumsPackage: org.springblade.dashboard.entity.enums
|
#typeEnumsPackage: org.springblade.dashboard.entity.enums
|
||||||
global-config:
|
global-config:
|
||||||
#刷新mapper 调试神器
|
|
||||||
refresh: ${blade.dev-mode}
|
|
||||||
# 关闭MP3.0自带的banner
|
# 关闭MP3.0自带的banner
|
||||||
banner: false
|
banner: false
|
||||||
db-config:
|
db-config:
|
||||||
#主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
|
#主键类型 0:"数据库ID自增", 1:"不操作", 2:"用户输入ID",3:"数字型snowflake", 4:"全局唯一ID UUID", 5:"字符串型snowflake";
|
||||||
id-type: 0
|
id-type: id_worker
|
||||||
#字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
|
#字段策略
|
||||||
field-strategy: 2
|
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
|
logic-delete-value: 1
|
||||||
# 逻辑未删除全局值(0表示未删除,Mybatis Plus的默认配置)
|
# 逻辑未删除全局值(0表示未删除,这也是Mybatis Plus的默认配置)
|
||||||
logic-not-delete-value: 0
|
logic-not-delete-value: 0
|
||||||
configuration:
|
configuration:
|
||||||
map-underscore-to-camel-case: true
|
map-underscore-to-camel-case: true
|
||||||
|
@ -93,7 +93,7 @@ public class BladeCodeGenerator {
|
|||||||
/**
|
/**
|
||||||
* 租户字段
|
* 租户字段
|
||||||
*/
|
*/
|
||||||
private String tenantColumn = "tenant_code";
|
private String tenantColumn = "tenant_id";
|
||||||
/**
|
/**
|
||||||
* 是否启用swagger
|
* 是否启用swagger
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +35,7 @@ public interface TokenConstant {
|
|||||||
String ROLE_ID = "role_id";
|
String ROLE_ID = "role_id";
|
||||||
String USER_NAME = "user_name";
|
String USER_NAME = "user_name";
|
||||||
String ROLE_NAME = "role_name";
|
String ROLE_NAME = "role_name";
|
||||||
String TENANT_CODE = "tenant_code";
|
String TENANT_ID = "tenant_id";
|
||||||
String CLIENT_ID = "client_id";
|
String CLIENT_ID = "client_id";
|
||||||
String LICENSE = "license";
|
String LICENSE = "license";
|
||||||
String LICENSE_NAME = "powered by blade";
|
String LICENSE_NAME = "powered by blade";
|
||||||
|
@ -28,9 +28,9 @@ import lombok.Data;
|
|||||||
public class TenantEntity extends BaseEntity {
|
public class TenantEntity extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户编号
|
* 租户ID
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "租户编号")
|
@ApiModelProperty(value = "租户ID")
|
||||||
private String tenantCode;
|
private String tenantId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,10 @@ public class BladeUser implements Serializable {
|
|||||||
@ApiModelProperty(hidden = true)
|
@ApiModelProperty(hidden = true)
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
/**
|
/**
|
||||||
* 租户编号
|
* 租户ID
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(hidden = true)
|
@ApiModelProperty(hidden = true)
|
||||||
private String tenantCode;
|
private String tenantId;
|
||||||
/**
|
/**
|
||||||
* 昵称
|
* 昵称
|
||||||
*/
|
*/
|
||||||
|
@ -49,7 +49,7 @@ public class SecureUtil {
|
|||||||
private final static String ROLE_ID = TokenConstant.ROLE_ID;
|
private final static String ROLE_ID = TokenConstant.ROLE_ID;
|
||||||
private final static String USER_NAME = TokenConstant.USER_NAME;
|
private final static String USER_NAME = TokenConstant.USER_NAME;
|
||||||
private final static String ROLE_NAME = TokenConstant.ROLE_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 String CLIENT_ID = TokenConstant.CLIENT_ID;
|
||||||
private final static Integer AUTH_LENGTH = TokenConstant.AUTH_LENGTH;
|
private final static Integer AUTH_LENGTH = TokenConstant.AUTH_LENGTH;
|
||||||
private static String BASE64_SECURITY = Base64.getEncoder().encodeToString(TokenConstant.SIGN_KEY.getBytes(Charsets.UTF_8));
|
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));
|
String clientId = Func.toStr(claims.get(SecureUtil.CLIENT_ID));
|
||||||
Integer userId = Func.toInt(claims.get(SecureUtil.USER_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 roleId = Func.toStr(claims.get(SecureUtil.ROLE_ID));
|
||||||
String account = Func.toStr(claims.get(SecureUtil.ACCOUNT));
|
String account = Func.toStr(claims.get(SecureUtil.ACCOUNT));
|
||||||
String roleName = Func.toStr(claims.get(SecureUtil.ROLE_NAME));
|
String roleName = Func.toStr(claims.get(SecureUtil.ROLE_NAME));
|
||||||
@ -103,7 +103,7 @@ public class SecureUtil {
|
|||||||
BladeUser bladeUser = new BladeUser();
|
BladeUser bladeUser = new BladeUser();
|
||||||
bladeUser.setClientId(clientId);
|
bladeUser.setClientId(clientId);
|
||||||
bladeUser.setUserId(userId);
|
bladeUser.setUserId(userId);
|
||||||
bladeUser.setTenantCode(tenantCode);
|
bladeUser.setTenantId(tenantId);
|
||||||
bladeUser.setAccount(account);
|
bladeUser.setAccount(account);
|
||||||
bladeUser.setRoleId(roleId);
|
bladeUser.setRoleId(roleId);
|
||||||
bladeUser.setRoleName(roleName);
|
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();
|
BladeUser user = getUser();
|
||||||
return (null == user) ? StringPool.EMPTY : user.getTenantCode();
|
return (null == user) ? StringPool.EMPTY : user.getTenantId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取租户编号
|
* 获取租户ID
|
||||||
*
|
*
|
||||||
* @param request request
|
* @param request request
|
||||||
* @return tenantCode
|
* @return tenantId
|
||||||
*/
|
*/
|
||||||
public static String getTenantCode(HttpServletRequest request) {
|
public static String getTenantId(HttpServletRequest request) {
|
||||||
BladeUser user = getUser(request);
|
BladeUser user = getUser(request);
|
||||||
return (null == user) ? StringPool.EMPTY : user.getTenantCode();
|
return (null == user) ? StringPool.EMPTY : user.getTenantId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取客户端id
|
* 获取客户端id
|
||||||
*
|
*
|
||||||
* @return tenantCode
|
* @return tenantId
|
||||||
*/
|
*/
|
||||||
public static String getClientId() {
|
public static String getClientId() {
|
||||||
BladeUser user = getUser();
|
BladeUser user = getUser();
|
||||||
@ -231,7 +231,7 @@ public class SecureUtil {
|
|||||||
* 获取客户端id
|
* 获取客户端id
|
||||||
*
|
*
|
||||||
* @param request request
|
* @param request request
|
||||||
* @return tenantCode
|
* @return tenantId
|
||||||
*/
|
*/
|
||||||
public static String getClientId(HttpServletRequest request) {
|
public static String getClientId(HttpServletRequest request) {
|
||||||
BladeUser user = getUser(request);
|
BladeUser user = getUser(request);
|
||||||
|
@ -66,9 +66,9 @@ public interface BladeConstant {
|
|||||||
int DB_ADMIN_LOCKED = 1;
|
int DB_ADMIN_LOCKED = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理员对应的租户编号
|
* 管理员对应的租户ID
|
||||||
*/
|
*/
|
||||||
String ADMIN_TENANT_CODE = "000000";
|
String ADMIN_TENANT_ID = "000000";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志默认状态
|
* 日志默认状态
|
||||||
|
Loading…
Reference in New Issue
Block a user