package cn.iocoder.yudao.module.product.task.job;

import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.product.dal.mysql.envdata.EnvDataMapper;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
@TenantJob
public class EnvDataJob {

    @Resource
    private EnvDataMapper envDataMapper;

    /**
     * 清理超过30天的环境数据
     * @return
     */
    @XxlJob("cleanUpLastEnvData")
    public ReturnT<String> cleanUpLastEnvData() {
        log.info("===============================> 调度任务开始清理环境数据 <===============================");
        envDataMapper.cleanDataWhenOverXDays(30);
        return ReturnT.SUCCESS;// 就算不返回  默认也是成功
    }

}
