mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 04:08:43 +08:00 
			
		
		
		
	优化多租户 Job 的实现,采用 AOP 替代 BeanPostProcessor,提升启动速度
This commit is contained in:
		@@ -11,14 +11,14 @@ import javax.annotation.Resource;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@Component
 | 
			
		||||
@TenantJob // 标记多租户
 | 
			
		||||
public class DemoJob implements JobHandler {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private AdminUserMapper adminUserMapper;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String execute(String param) throws Exception {
 | 
			
		||||
    @TenantJob // 标记多租户
 | 
			
		||||
    public String execute(String param) {
 | 
			
		||||
        System.out.println("当前租户:" + TenantContextHolder.getTenantId());
 | 
			
		||||
        List<AdminUserDO> users = adminUserMapper.selectList();
 | 
			
		||||
        return "用户数量:" + users.size();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user