Ver código fonte

中英文切换代码提交

kouchengxing 5 anos atrás
pai
commit
f3802b0a55

+ 5 - 0
dgtly-apiframework/src/main/java/com/dgtly/apiframework/config/SwitchEnSqlInterceptorConfig.java

@@ -1,8 +1,12 @@
 package com.dgtly.apiframework.config;
 
 import com.dgtly.apiframework.interceptor.SwitchEnSqlInterceptor;
+import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
 import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
 import org.springframework.context.annotation.Configuration;
 
 import javax.annotation.PostConstruct;
@@ -12,6 +16,7 @@ import java.util.Properties;
 
 
 @Configuration
+@AutoConfigureAfter({PageHelperAutoConfiguration.class})
 public class SwitchEnSqlInterceptorConfig {
 
         @Autowired

+ 4 - 8
dgtly-apiframework/src/main/java/com/dgtly/apiframework/interceptor/SwitchEnSqlInterceptor.java

@@ -65,16 +65,12 @@ public class SwitchEnSqlInterceptor  implements Interceptor {
                     }
                 }
             }
+            // 改变sql语句
+            BoundSql newBoundSql = new BoundSql(mappedStatement.getConfiguration(), oldsql ,
+                    boundSql.getParameterMappings(), boundSql.getParameterObject());
+            invocation.getArgs()[5] = newBoundSql;
         }
 
-        // log.info("old:"+oldsql);
-
-        // 改变sql语句
-        BoundSql newBoundSql = new BoundSql(mappedStatement.getConfiguration(), oldsql ,
-                boundSql.getParameterMappings(), boundSql.getParameterObject());
-        invocation.getArgs()[5] = newBoundSql;
-
-
         // 继续执行
         Object result = invocation.proceed();
         return result;