From f4bde35ff66aec0597ed7d21d1f5ba89893d70ff Mon Sep 17 00:00:00 2001 From: smallchill Date: Sat, 9 Mar 2019 10:58:48 +0800 Subject: [PATCH] :tada: 2.1.0.RELEASE --- blade-core-boot/pom.xml | 2 +- .../boot/config/MybatisPlusConfiguration.java | 2 + blade-core-cloud/pom.xml | 2 +- blade-core-launch/pom.xml | 2 +- blade-core-log/pom.xml | 2 +- blade-core-mybatis/pom.xml | 2 +- blade-core-secure/pom.xml | 2 +- .../springblade/core/secure/BladeUser.java | 7 +- .../secure/interceptor/SecureInterceptor.java | 3 +- .../core/secure/registry/SecureRegistry.java | 4 +- .../core/secure/utils/SecureUtil.java | 58 +++++++++++- blade-core-swagger/pom.xml | 2 +- blade-core-tenant/pom.xml | 25 ++++++ .../BladeTenantHandler.java | 67 ++++++++++++++ .../BladeTenantId.java | 31 +++++++ .../BladeTenantProperties.java | 50 +++++++++++ .../TenantConfiguration.java | 88 +++++++++++++++++++ .../org.springblade.core.tenant/TenantId.java | 31 +++++++ .../mp/TenantEntity.java | 37 ++++++++ blade-core-tool/pom.xml | 2 +- .../core/tool/constant/BladeConstant.java | 17 ++-- .../core/tool/constant/RoleConstant.java | 2 +- pom.xml | 5 +- 23 files changed, 420 insertions(+), 23 deletions(-) create mode 100644 blade-core-tenant/pom.xml create mode 100644 blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantHandler.java create mode 100644 blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantId.java create mode 100644 blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantProperties.java create mode 100644 blade-core-tenant/src/main/java/org.springblade.core.tenant/TenantConfiguration.java create mode 100644 blade-core-tenant/src/main/java/org.springblade.core.tenant/TenantId.java create mode 100644 blade-core-tenant/src/main/java/org.springblade.core.tenant/mp/TenantEntity.java diff --git a/blade-core-boot/pom.xml b/blade-core-boot/pom.xml index 75b5a4a..fdc5fc3 100644 --- a/blade-core-boot/pom.xml +++ b/blade-core-boot/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.0.8 + 2.1.0 4.0.0 diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/config/MybatisPlusConfiguration.java b/blade-core-boot/src/main/java/org/springblade/core/boot/config/MybatisPlusConfiguration.java index 61ef35f..2a3588c 100644 --- a/blade-core-boot/src/main/java/org/springblade/core/boot/config/MybatisPlusConfiguration.java +++ b/blade-core-boot/src/main/java/org/springblade/core/boot/config/MybatisPlusConfiguration.java @@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor; import org.mybatis.spring.annotation.MapperScan; import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.mp.BladeMetaObjectHandler; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @@ -36,6 +37,7 @@ import org.springframework.context.annotation.Profile; public class MybatisPlusConfiguration { @Bean + @ConditionalOnMissingBean(PaginationInterceptor.class) public PaginationInterceptor paginationInterceptor() { return new PaginationInterceptor(); } diff --git a/blade-core-cloud/pom.xml b/blade-core-cloud/pom.xml index 944a0b3..bdcefb1 100644 --- a/blade-core-cloud/pom.xml +++ b/blade-core-cloud/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.8 + 2.1.0 4.0.0 diff --git a/blade-core-launch/pom.xml b/blade-core-launch/pom.xml index 2bffe46..6008080 100644 --- a/blade-core-launch/pom.xml +++ b/blade-core-launch/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.8 + 2.1.0 4.0.0 diff --git a/blade-core-log/pom.xml b/blade-core-log/pom.xml index 0c7dbfa..d6bb2a2 100644 --- a/blade-core-log/pom.xml +++ b/blade-core-log/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.8 + 2.1.0 4.0.0 diff --git a/blade-core-mybatis/pom.xml b/blade-core-mybatis/pom.xml index 6eb8777..ea54d22 100644 --- a/blade-core-mybatis/pom.xml +++ b/blade-core-mybatis/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.8 + 2.1.0 4.0.0 diff --git a/blade-core-secure/pom.xml b/blade-core-secure/pom.xml index 95112cf..f95a64e 100644 --- a/blade-core-secure/pom.xml +++ b/blade-core-secure/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.8 + 2.1.0 4.0.0 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 444d768..f10d2a9 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 @@ -31,10 +31,15 @@ public class BladeUser implements Serializable { private static final long serialVersionUID = 1L; /** - * 主键 + * 用户id */ @ApiModelProperty(hidden = true) private Integer userId; + /** + * 租户编号 + */ + @ApiModelProperty(hidden = true) + private String tenantCode; /** * 昵称 */ diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/interceptor/SecureInterceptor.java b/blade-core-secure/src/main/java/org/springblade/core/secure/interceptor/SecureInterceptor.java index 0834571..0c792b2 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/interceptor/SecureInterceptor.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/interceptor/SecureInterceptor.java @@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.secure.utils.SecureUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.ResultCode; +import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.utils.StringPool; import org.springblade.core.tool.utils.WebUtil; @@ -46,7 +47,7 @@ public class SecureInterceptor extends HandlerInterceptorAdapter { log.warn("签名认证失败,请求接口:{},请求IP:{},请求参数:{}", request.getRequestURI(), WebUtil.getIP(request), JsonUtil.toJson(request.getParameterMap())); R result = R.fail(ResultCode.UN_AUTHORIZED); response.setCharacterEncoding(StringPool.UTF_8); - response.setHeader("Content-type", MediaType.APPLICATION_JSON_UTF8_VALUE); + response.setHeader(BladeConstant.CONTENT_TYPE_NAME, MediaType.APPLICATION_JSON_UTF8_VALUE); response.setStatus(HttpServletResponse.SC_OK); try { response.getWriter().write(Objects.requireNonNull(JsonUtil.toJson(result))); diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/registry/SecureRegistry.java b/blade-core-secure/src/main/java/org/springblade/core/secure/registry/SecureRegistry.java index 771bb46..cdfe955 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/registry/SecureRegistry.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/registry/SecureRegistry.java @@ -42,8 +42,10 @@ public class SecureRegistry { this.defaultExcludePatterns.add("/auth/**"); this.defaultExcludePatterns.add("/token/**"); this.defaultExcludePatterns.add("/log/**"); - this.defaultExcludePatterns.add("/user/userInfo"); + this.defaultExcludePatterns.add("/user/user-info"); + this.defaultExcludePatterns.add("/menu/auth-routes"); this.defaultExcludePatterns.add("/error/**"); + this.defaultExcludePatterns.add("/assets/**"); } /** 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 0364f47..0fc374e 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 @@ -28,7 +28,10 @@ import org.springblade.core.tool.utils.WebUtil; import javax.crypto.spec.SecretKeySpec; import javax.servlet.http.HttpServletRequest; import java.security.Key; -import java.util.*; +import java.util.Base64; +import java.util.Calendar; +import java.util.Date; +import java.util.Map; /** * Secure工具类 @@ -45,8 +48,9 @@ public class SecureUtil { public final static String ROLE_ID = "roleId"; public final static String USER_NAME = "userName"; public final static String ROLE_NAME = "roleName"; + public final static String TENANT_CODE = "tenantCode"; public final static Integer AUTH_LENGTH = 7; - private static String BASE64_SECURITY = Base64.getEncoder().encodeToString("SpringBlade".getBytes(Charsets.UTF_8)); + public static String BASE64_SECURITY = Base64.getEncoder().encodeToString("BladeX".getBytes(Charsets.UTF_8)); /** * 获取用户信息 @@ -79,14 +83,18 @@ public class SecureUtil { return null; } Integer userId = Func.toInt(claims.get(SecureUtil.USER_ID)); + String tenantCode = Func.toStr(claims.get(SecureUtil.TENANT_CODE)); 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)); + String userName = Func.toStr(claims.get(SecureUtil.USER_NAME)); BladeUser bladeUser = new BladeUser(); - bladeUser.setAccount(account); bladeUser.setUserId(userId); + bladeUser.setTenantCode(tenantCode); + bladeUser.setAccount(account); bladeUser.setRoleId(roleId); bladeUser.setRoleName(roleName); + bladeUser.setUserName(userName); return bladeUser; } @@ -133,6 +141,48 @@ public class SecureUtil { return (null == user) ? StringPool.EMPTY : user.getAccount(); } + /** + * 获取用户名 + * + * @return userName + */ + public static String getUserName() { + BladeUser user = getUser(); + return (null == user) ? StringPool.EMPTY : user.getUserName(); + } + + /** + * 获取用户名 + * + * @param request request + * @return userName + */ + public static String getUserName(HttpServletRequest request) { + BladeUser user = getUser(request); + return (null == user) ? StringPool.EMPTY : user.getUserName(); + } + + /** + * 获取租户编号 + * + * @return tenantCode + */ + public static String getTenantCode() { + BladeUser user = getUser(); + return (null == user) ? StringPool.EMPTY : user.getTenantCode(); + } + + /** + * 获取租户编号 + * + * @param request request + * @return tenantCode + */ + public static String getTenantCode(HttpServletRequest request) { + BladeUser user = getUser(request); + return (null == user) ? StringPool.EMPTY : user.getTenantCode(); + } + /** * 获取Claims * @@ -157,7 +207,7 @@ public class SecureUtil { * @return header */ public static String getHeader() { - return getHeader(Objects.requireNonNull(WebUtil.getRequest())); + return getHeader(WebUtil.getRequest()); } /** diff --git a/blade-core-swagger/pom.xml b/blade-core-swagger/pom.xml index 8254bcc..a2c6d95 100644 --- a/blade-core-swagger/pom.xml +++ b/blade-core-swagger/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.8 + 2.1.0 4.0.0 diff --git a/blade-core-tenant/pom.xml b/blade-core-tenant/pom.xml new file mode 100644 index 0000000..6e56be6 --- /dev/null +++ b/blade-core-tenant/pom.xml @@ -0,0 +1,25 @@ + + + + blade-tool + org.springblade + 2.1.0 + + 4.0.0 + + blade-core-tenant + ${project.artifactId} + ${blade.tool.version} + jar + + + + org.springblade + blade-core-mybatis + ${blade.tool.version} + + + + diff --git a/blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantHandler.java b/blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantHandler.java new file mode 100644 index 0000000..5b14b90 --- /dev/null +++ b/blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantHandler.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * 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 org.springblade.core.tenant; + +import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import net.sf.jsqlparser.expression.Expression; +import net.sf.jsqlparser.expression.StringValue; +import org.springblade.core.secure.utils.SecureUtil; +import org.springblade.core.tool.utils.StringUtil; + +/** + * 租户信息处理器 + * + * @author Chill + */ +@Slf4j +@AllArgsConstructor +public class BladeTenantHandler implements TenantHandler { + + private final BladeTenantProperties properties; + + /** + * 获取租户编号 + * + * @return 租户编号 + */ + @Override + public Expression getTenantId() { + return new StringValue(SecureUtil.getTenantCode()); + } + + /** + * 获取租户字段名称 + * + * @return 租户字段名称 + */ + @Override + public String getTenantIdColumn() { + return properties.getColumn(); + } + + /** + * 过滤租户表 + * + * @param tableName 表名 + * @return 是否进行过滤 + */ + @Override + public boolean doTableFilter(String tableName) { + return (properties.getTables().size() > 0 && !properties.getTables().contains(tableName)) || !properties.getBladeTables().contains(tableName) || StringUtil.isBlank(SecureUtil.getTenantCode()); + } +} diff --git a/blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantId.java b/blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantId.java new file mode 100644 index 0000000..890e60d --- /dev/null +++ b/blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantId.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * 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 org.springblade.core.tenant; + +import org.springblade.core.tool.utils.RandomType; +import org.springblade.core.tool.utils.StringUtil; + +/** + * blade租户id生成器 + * + * @author Chill + */ +public class BladeTenantId implements TenantId { + @Override + public String generate() { + return StringUtil.random(6, RandomType.INT); + } +} diff --git a/blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantProperties.java b/blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantProperties.java new file mode 100644 index 0000000..dcaa647 --- /dev/null +++ b/blade-core-tenant/src/main/java/org.springblade.core.tenant/BladeTenantProperties.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * 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 org.springblade.core.tenant; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * 多租户配置 + * + * @author Chill + */ +@Getter +@Setter +@ConfigurationProperties(prefix = "blade.tenant") +public class BladeTenantProperties { + + /** + * 多租户字段名称 + */ + private String column = "tenant_code"; + + /** + * 多租户数据表 + */ + private List tables = new ArrayList<>(); + + /** + * 多租户系统数据表 + */ + private List bladeTables = Arrays.asList("blade_notice", "blade_log_api", "blade_log_error", "blade_log_usual"); +} diff --git a/blade-core-tenant/src/main/java/org.springblade.core.tenant/TenantConfiguration.java b/blade-core-tenant/src/main/java/org.springblade.core.tenant/TenantConfiguration.java new file mode 100644 index 0000000..515ddcc --- /dev/null +++ b/blade-core-tenant/src/main/java/org.springblade.core.tenant/TenantConfiguration.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * 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 org.springblade.core.tenant; + +import com.baomidou.mybatisplus.core.MybatisConfiguration; +import com.baomidou.mybatisplus.core.parser.ISqlParser; +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler; +import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser; +import lombok.AllArgsConstructor; +import org.springframework.boot.autoconfigure.AutoConfigureBefore; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.ArrayList; +import java.util.List; + +/** + * 多租户配置类 + * + * @author Chill + */ +@Configuration +@AllArgsConstructor +@AutoConfigureBefore(MybatisConfiguration.class) +@EnableConfigurationProperties(BladeTenantProperties.class) +public class TenantConfiguration { + + /** + * 多租户配置类 + */ + private final BladeTenantProperties properties; + + /** + * 自定义租户处理器 + * + * @return TenantHandler + */ + @Bean + @ConditionalOnMissingBean(TenantHandler.class) + public TenantHandler bladeTenantHandler() { + return new BladeTenantHandler(properties); + } + + /** + * 自定义租户id生成器 + * + * @return TenantId + */ + @Bean + @ConditionalOnMissingBean(TenantId.class) + public TenantId tenantId() { + return new BladeTenantId(); + } + + /** + * 分页插件 + * + * @param tenantHandler 自定义租户处理器 + * @return PaginationInterceptor + */ + @Bean + public PaginationInterceptor paginationInterceptor(TenantHandler tenantHandler) { + PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); + List sqlParserList = new ArrayList<>(); + TenantSqlParser tenantSqlParser = new TenantSqlParser(); + tenantSqlParser.setTenantHandler(tenantHandler); + sqlParserList.add(tenantSqlParser); + paginationInterceptor.setSqlParserList(sqlParserList); + return paginationInterceptor; + } + +} diff --git a/blade-core-tenant/src/main/java/org.springblade.core.tenant/TenantId.java b/blade-core-tenant/src/main/java/org.springblade.core.tenant/TenantId.java new file mode 100644 index 0000000..c0a447b --- /dev/null +++ b/blade-core-tenant/src/main/java/org.springblade.core.tenant/TenantId.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * 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 org.springblade.core.tenant; + +/** + * 租户id生成器 + * + * @author Chill + */ +public interface TenantId { + + /** + * 生成自定义租户id + * @return + */ + String generate(); + +} diff --git a/blade-core-tenant/src/main/java/org.springblade.core.tenant/mp/TenantEntity.java b/blade-core-tenant/src/main/java/org.springblade.core.tenant/mp/TenantEntity.java new file mode 100644 index 0000000..1ea7d3c --- /dev/null +++ b/blade-core-tenant/src/main/java/org.springblade.core.tenant/mp/TenantEntity.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * 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 org.springblade.core.tenant.mp; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springblade.core.mp.base.BaseEntity; + +/** + * 租户基础实体类 + * + * @author Chill + */ +@Data +public class TenantEntity extends BaseEntity { + + /** + * 租户编号 + */ + @ApiModelProperty(value = "租户编号") + private String tenantCode; + +} diff --git a/blade-core-tool/pom.xml b/blade-core-tool/pom.xml index 5c680c3..802a074 100644 --- a/blade-core-tool/pom.xml +++ b/blade-core-tool/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-tool - 2.0.8 + 2.1.0 4.0.0 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 5b356a4..87f8f2f 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 @@ -27,10 +27,15 @@ public interface BladeConstant { */ String UTF_8 = "UTF-8"; + /** + * contentType + */ + String CONTENT_TYPE_NAME = "Content-type"; + /** * JSON 资源 */ - String CONTENT_TYPE = "application/json; charset=utf-8"; + String CONTENT_TYPE = "application/json;charset=utf-8"; /** * 角色前缀 @@ -47,10 +52,7 @@ public interface BladeConstant { */ int DB_STATUS_NORMAL = 1; - /** - * 是否删除字段名 - */ - String IS_DELETED_FIELD = "is_deleted"; + /** * 删除状态[0:正常,1:删除] */ @@ -63,6 +65,11 @@ public interface BladeConstant { int DB_ADMIN_NON_LOCKED = 0; int DB_ADMIN_LOCKED = 1; + /** + * 管理员对应的租户编号 + */ + String ADMIN_TENANT_CODE = "000000"; + /** * 日志默认状态 */ diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/constant/RoleConstant.java b/blade-core-tool/src/main/java/org/springblade/core/tool/constant/RoleConstant.java index 1e70272..9e5c5e8 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/constant/RoleConstant.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/constant/RoleConstant.java @@ -22,7 +22,7 @@ package org.springblade.core.tool.constant; */ public class RoleConstant { - public static final String ADMIN = "admin"; + public static final String ADMIN = "administrator"; public static final String HAS_ROLE_ADMIN = "hasRole('" + ADMIN + "')"; diff --git a/pom.xml b/pom.xml index 024c627..8002927 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.0.8 + 2.1.0 pom blade-tool @@ -36,7 +36,7 @@ - 2.0.8 + 2.1.0 1.8 3.8.0 @@ -68,6 +68,7 @@ blade-core-mybatis blade-core-swagger blade-core-cloud + blade-core-tenant