package com.changhong.epc.config.aop.rest; import org.aspectj.lang.annotation.Aspect; import org.springframework.stereotype.Component; import com.changhong.epc.constter.base.BaseBean; import com.iemsoft.framework.cloud.config.aop.rest.RestFormatAdvisor; import com.iemsoft.framework.cloud.core.thread.Keys; import com.iemsoft.framework.cloud.core.thread.ThreadData; import com.iemsoft.framework.cloud.core.tools.ObjectUtil; import lombok.extern.slf4j.Slf4j; @Aspect @Component @Slf4j public class RestAdvisor extends RestFormatAdvisor { @Override protected void begin(RestInfo ri) { Object[] args = ri.getArgs(); if(ObjectUtil.notEmpty(args) && args[0] instanceof BaseBean){ BaseBean bp = (BaseBean) args[0]; ThreadData.set(Keys.PAGE_NUM, bp.getPageNum()); ThreadData.set(Keys.PAGE_SIZE, bp.getPageSize()); log.debug("添加分页参数{},{}", bp.getPageNum(), bp.getPageSize()); } } @Override protected boolean isFilter(RestInfo ri) { return ri.getClazz().getName().startsWith("com.changhong.epc"); } }