Loki
2 years ago
2 changed files with 31 additions and 1 deletions
@ -0,0 +1,29 @@ |
|||||||
|
package co.yixiang.aspect; |
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.aspectj.lang.JoinPoint; |
||||||
|
import org.aspectj.lang.annotation.AfterReturning; |
||||||
|
import org.aspectj.lang.annotation.Aspect; |
||||||
|
import org.aspectj.lang.annotation.Pointcut; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
/** |
||||||
|
* 如果有新租户需要创建 ,则需要调用这个方法执行一些操作,初始化一些数据 |
||||||
|
* 如动态图设计。前端可以不用,后端这个功能依然保持,七牛初始化配置。 |
||||||
|
* |
||||||
|
*/ |
||||||
|
@Aspect |
||||||
|
@Component |
||||||
|
@Slf4j |
||||||
|
public class TenantInitAspect { |
||||||
|
|
||||||
|
@Pointcut("execution(* cn.iocoder.yudao.module.system.dal.mysql.tenant.TenantMapper.insert(..))") |
||||||
|
public void tenantInit(){} |
||||||
|
|
||||||
|
@AfterReturning(value = "tenantInit()",returning = "tenant") |
||||||
|
public void afterTenantInit(JoinPoint point, TenantDO tenant){ |
||||||
|
log.info("新租户被加入,准备初始化...{}",tenant); |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue