Browse Source

多语言拦sql修改

wanglang 2 days ago
parent
commit
d1604680ca

+ 9 - 1
trade-common/src/main/java/com/trade/common/config/mybatis/plugin/I18nSqlProcessInterceptor.java

@@ -256,7 +256,15 @@ public class I18nSqlProcessInterceptor implements Interceptor {
                 if (methodSupported(SqlCommandType.SELECT, baseMethodStr) && classSupported) {
                     if (Map.class.isAssignableFrom(parameterClass)) {
                         BoundSql boundSql = ms.getSqlSource().getBoundSql(parameter);
-                        MapperMethod.ParamMap parameterMap = (MapperMethod.ParamMap) boundSql.getParameterObject();
+                        MapperMethod.ParamMap parameterMap;
+                        if (boundSql.getParameterObject() instanceof HashMap) {
+                            HashMap<String, Object> hashMap = (HashMap<String, Object>) boundSql.getParameterObject();
+                            parameterMap = new MapperMethod.ParamMap();
+                            parameterMap.putAll(hashMap);
+                        } else {
+                             parameterMap = (MapperMethod.ParamMap) boundSql.getParameterObject();
+                        }
+
                         Object ew = parameterMap.get("ew");
                         if (ew instanceof Non18nWrapper) {
                             return baseResult;