first commit
This commit is contained in:
@ -76,7 +76,7 @@ public class BaseContext {
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public static Boolean getSchema() {
|
||||
public static Boolean isSchemaMode() {
|
||||
return SCHEMA_HOLDER.get();
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ public class SchemaInterceptor implements InnerInterceptor {
|
||||
@Override
|
||||
public void beforePrepare(StatementHandler sh, Connection conn, Integer transactionTimeout) {
|
||||
|
||||
if (Objects.nonNull(BaseContext.getSchema()) && BaseContext.getSchema()) {
|
||||
// use qiaoba-1;
|
||||
if (Objects.nonNull(BaseContext.isSchemaMode()) && BaseContext.isSchemaMode()) {
|
||||
// eg: use qiaoba-1;
|
||||
String sql = StrUtil.format("use `{}-{}`;", baseDatabase, BaseContext.getTenantId());
|
||||
try {
|
||||
conn.createStatement().execute(sql);
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.qiaoba.common.web.utils;
|
||||
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
|
||||
/**
|
||||
* UriUtil
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @since 2023-06-11 12:01:18
|
||||
*/
|
||||
public class UriUtil {
|
||||
|
||||
private static final AntPathMatcher MATCH = new AntPathMatcher();
|
||||
|
||||
private UriUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通配符匹配
|
||||
*
|
||||
* @param pattern 通配符
|
||||
* @param path uri
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean match(String pattern, String path) {
|
||||
return MATCH.match(pattern, path);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user