81,092
社区成员
发帖
与我相关
我的任务
分享
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface NoFilter {
String value() default "";
}
@Override
public Object intercept(Invocation invocation) throws Throwable {
// final Executor executor = (Executor) invocation.getTarget();
final Object[] args = invocation.getArgs();
final MappedStatement mappedStatement = (MappedStatement) args[0];
final Object parameter = args[1];
final RowBounds rowBounds = (RowBounds) args[2];
String namespace = mappedStatement.getId();
String className = namespace.substring(0,namespace.lastIndexOf("."));
String methedName= namespace.substring(namespace.lastIndexOf(".") + 1,namespace.length());
Method[] ms = Class.forName(className).getMethods();
for(Method m : ms){
if(m.getName().equals(methedName)){
Annotation annotation = m.getAnnotation(NoFilter.class);
System.out.println(annotation.toString());
};
}
}