first commit

This commit is contained in:
2023-06-11 12:21:49 +08:00
parent 4dcb7c297b
commit d1990dc0e3
7 changed files with 106 additions and 13 deletions

View File

@ -76,7 +76,7 @@ public class BaseContext {
*
* @return Boolean
*/
public static Boolean getSchema() {
public static Boolean isSchemaMode() {
return SCHEMA_HOLDER.get();
}

View File

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

View File

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