
com.zlyx.easymybatis.aspect.MybatisAspect Maven / Gradle / Ivy
package com.zlyx.easymybatis.aspect;
import java.lang.reflect.Method;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import com.zlyx.easydatabase.local.ReturnType;
@Aspect
public class MybatisAspect {
@Pointcut("@annotation(org.apache.ibatis.annotations.Select)||"
+ "@annotation(org.apache.ibatis.annotations.SelectProvider)")
public void select() {}
@Around("select()")
public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
if(ReturnType.getType() == null) {
Signature signature = pjp.getSignature();
MethodSignature methodSignature = (MethodSignature) signature;
Method method = methodSignature.getMethod();
ReturnType.setType(method);
}
return pjp.proceed();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy