package com.cico.nest.lcdp.boot.core.system.job;

import com.cico.nest.lcdp.boot.core.system.dal.dataobject.user.AdminUserDO;
import com.cico.nest.lcdp.boot.core.system.dal.mysql.user.AdminUserMapper;
import com.cico.nest.lcdp.boot.tenant.core.context.TenantContextHolder;
import com.cico.nest.lcdp.boot.tenant.core.job.TenantJob;
import com.cico.nest.lcdp.framework.job.quartz.core.handler.JobHandler;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class DemoJob implements JobHandler {

    @Resource
    private AdminUserMapper adminUserMapper;

    @Override
    @TenantJob // 标记多租户
    public String execute(String param) {
        System.out.println("当前租户：" + TenantContextHolder.getTenantId());
        List<AdminUserDO> users = adminUserMapper.selectList();
        return "用户数量：" + users.size();
    }

}
