| @@ -14,6 +14,7 @@ import org.apache.ibatis.executor.statement.StatementHandler; | |||||
| import org.apache.ibatis.logging.LogFactory; | import org.apache.ibatis.logging.LogFactory; | ||||
| import org.apache.ibatis.mapping.BoundSql; | import org.apache.ibatis.mapping.BoundSql; | ||||
| import org.apache.ibatis.mapping.MappedStatement; | import org.apache.ibatis.mapping.MappedStatement; | ||||
| import org.apache.ibatis.mapping.StatementType; | |||||
| import org.apache.ibatis.plugin.*; | import org.apache.ibatis.plugin.*; | ||||
| import org.apache.ibatis.reflection.MetaObject; | import org.apache.ibatis.reflection.MetaObject; | ||||
| import org.apache.ibatis.reflection.SystemMetaObject; | import org.apache.ibatis.reflection.SystemMetaObject; | ||||
| @@ -86,7 +87,11 @@ public class ShardingSpherePlugin implements MyBatisPlus { | |||||
| MetaObject metaStatementHandler = SystemMetaObject.forObject(statementHandler); | MetaObject metaStatementHandler = SystemMetaObject.forObject(statementHandler); | ||||
| MappedStatement ms = (MappedStatement) metaStatementHandler.getValue("delegate.mappedStatement"); | MappedStatement ms = (MappedStatement) metaStatementHandler.getValue("delegate.mappedStatement"); | ||||
| //String id = ms.getId(); | |||||
| if(ms.getStatementType().equals(StatementType.CALLABLE)){ | |||||
| return chainMap; | |||||
| } | |||||
| //String id = ms.getId(); | |||||
| //String className = id.substring(0, id.lastIndexOf(".")); | //String className = id.substring(0, id.lastIndexOf(".")); | ||||
| //String methodName = id.substring(id.lastIndexOf(".") + 1); | //String methodName = id.substring(id.lastIndexOf(".") + 1); | ||||
| //Class<?> clazz = Class.forName(className); | //Class<?> clazz = Class.forName(className); | ||||
| @@ -94,10 +99,10 @@ public class ShardingSpherePlugin implements MyBatisPlus { | |||||
| //if (method != null) { | //if (method != null) { | ||||
| // IgnoreSharding ignore = method.getAnnotation(IgnoreSharding.class); | // IgnoreSharding ignore = method.getAnnotation(IgnoreSharding.class); | ||||
| // if (null == ignore) { | // if (null == ignore) { | ||||
| // Object parameterObject = metaStatementHandler.getValue("delegate.boundSql.parameterObject"); | |||||
| // BoundSql boundSql = statementHandler.getBoundSql(); | |||||
| // String newSQL = buildTable(boundSql,parameterObject,chainMap); | |||||
| // metaStatementHandler.setValue("delegate.boundSql.sql", newSQL); | |||||
| Object parameterObject = metaStatementHandler.getValue("delegate.boundSql.parameterObject"); | |||||
| BoundSql boundSql = statementHandler.getBoundSql(); | |||||
| String newSQL = buildTable(boundSql,parameterObject,chainMap); | |||||
| metaStatementHandler.setValue("delegate.boundSql.sql", newSQL); | |||||
| // } | // } | ||||
| //} | //} | ||||
| //没有添加字段,只是根据字段分表,没有别的需要返回 | //没有添加字段,只是根据字段分表,没有别的需要返回 | ||||