package com.mosty.common.core.business.timer;

import com.mosty.common.core.business.service.SysDeptService;
import com.mosty.common.core.business.service.SysUserService;
import lombok.AllArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * 用户部门数据同步
 * @title: DeptUserSys
 * @projectName mosty-common
 * @description: TODO
 * @date 2022/8/27 16:52
 */
@Component
@AllArgsConstructor
public class DeptUserSys {

    private SysDeptService sysDeptService;

    private SysUserService sysUserService;

//    @Scheduled(cron = "0 0 1 * * ?")
    @Transactional
    public void run() {
        //同步部门数据
        sysDeptService.deptSys();
        //同步用户数据
        sysUserService.userSys();
    }

}
