yangys
2024-05-18 040976de6f9934b99f30268a28e2ecf42260e217
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.qianwen.core.tenant.aspect;
 
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.qianwen.core.tenant.BladeTenantHolder;
import com.qianwen.core.tenant.annotation.TenantIgnore;
 
@Aspect
 
public class BladeTenantAspect {
    private static final Logger log = LoggerFactory.getLogger(BladeTenantAspect.class);
 
    @Around("@annotation(tenantIgnore)")
    public Object around(ProceedingJoinPoint point, TenantIgnore tenantIgnore) throws Throwable {
        try {
            BladeTenantHolder.setIgnore(Boolean.TRUE);
            Object proceed = point.proceed();
            BladeTenantHolder.clear();
            return proceed;
        } catch (Throwable th) {
            BladeTenantHolder.clear();
            throw th;
        }
    }
}