|
@@ -34,6 +34,7 @@ public class SwitchEnSqlInterceptor implements Interceptor {
|
|
|
}
|
|
|
|
|
|
public Object intercept(Invocation invocation) throws Throwable {
|
|
|
+ System.out.println("进入拦截器----------------------------------------------");
|
|
|
// 获取原始sql语句
|
|
|
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
|
|
|
Object parameter = invocation.getArgs()[1];
|
|
@@ -46,13 +47,13 @@ public class SwitchEnSqlInterceptor implements Interceptor {
|
|
|
String language = request.getHeader("language");
|
|
|
|
|
|
if(StringUtils.isNotEmpty(language) && "en".equalsIgnoreCase(language)){
|
|
|
-
|
|
|
// 方法中含有获取注解
|
|
|
Class<?> classType = Class.forName(mappedStatement.getId().substring(0,mappedStatement.getId().lastIndexOf(".")));
|
|
|
String mName = mappedStatement.getId().substring(mappedStatement.getId().lastIndexOf(".") + 1 ,mappedStatement.getId().length());
|
|
|
for(Method method : classType.getDeclaredMethods()){
|
|
|
if(method!=null && mName.equals(method.getName()) && method.isAnnotationPresent(SwitchEn.class))
|
|
|
{
|
|
|
+ System.out.println("处理boundSql------------------------------------");
|
|
|
SwitchEn switchEn = method.getAnnotation(SwitchEn.class);
|
|
|
String[] oldfiles = switchEn.oldfiles();
|
|
|
String[] newfiles = switchEn.newfiles();
|