利用AOP抓取到service方法中的sql并进行SQL拼接,实现数据过滤

利用AOP抓取到service方法中的sql并进行SQL拼接,实现数据过滤,并且不能影响的原方法中的功能(Query查询这种)
该怎么做呢

修改sql筛选数据,并保证不影响所有业务的功能,我也想知道哪位神仙能做到。

@Component
@EnableConfigurationProperties(TenancyProperties.class)
@Intercepts({
        @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class, Integer.class }) })
public class TenancyInterceptor implements Interceptor {
      @Override
    public Object intercept(Invocation invocation) throws Exception {
        MappedStatement mappedStatement = MyBatisPluginTools.getStatement(invocation);
        RoutingStatementHandler handler = (RoutingStatementHandler) invocation.getTarget();
        BoundSql boundSql = handler.getBoundSql();
        // 操作boundSql 去设置要拼接的SQL
    }
}