```java
@Aspect
@Component
public class PagerAop {
/**
* 拦截DAO执行之前的参数,并初始化分页插件
*
* @param joinPoint
* @throws InterruptedException
*/
@Before("execution(java.util.List com.weein.admin.dao.*.select*(..))" +
"|| execution(java.util.List com.weein.admin.add_moment_task.dao.*.select*(..))")
public void before(JoinPoint joinPoint) throws InterruptedException {
if (null == joinPoint.getArgs() || joinPoint.getArgs().length == 0
|| !(joinPoint.getArgs()[0] instanceof Map)) {
return;
}
HashMap<String, Object> params = (HashMap<String, Object>) joinPoint.getArgs()[0];
if (null != params.get(CommonsConstants.MYBATIS_PARAMS_PAGE_NO)
&& null != params.get(CommonsConstants.MYBATIS_PARAMS_PAGE_SIZE)) {
PageHelper.startPage((Integer) params.get(CommonsConstants.MYBATIS_PARAMS_PAGE_NO),
(Integer) params.get(CommonsConstants.MYBATIS_PARAMS_PAGE_SIZE));
}
}
}
@Before(“execution(java.util.List com.weein.admin.dao..select(…))” +
“|| execution(java.util.List com.weein.admin.add_moment_task.dao..select(…))”)