Mapper方法拦截器
只支持自己写的Mapper方法,且是第一个Mapper方法,配合自己的注解,用于权限等等操作
编写Mapper方法拦截器
java
MyMapperMethodInterceptor implements MethodInterceptor {
@Override
public Object around (Invocation invocation) throws Throwable {
try {
System.out.println(invocation.getMethod());
if (invocation.getMethod().isAnnotationPresent(MapperLimit.class)) {
System.out.println(">>1111>>>>>>>start");
}
return invocation.proceed();
} finally {
System.out.println(">>1111>>>>>>>end");
}
}
}
启动是配置Mapper方法拦截器
java
XbatisGlobalConfig.addMapperMethodInterceptor(new MyMapperMethodInterceptor());