package com.njcn.user.init;

import com.njcn.user.service.IFunctionService;
import com.njcn.user.service.IUserService;
import com.njcn.user.service.impl.UserServiceImpl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;


/**
 * @author hongawen
 *
 * 容器启动完成时加载角色权限规则至Redis缓存
 */
@Slf4j
@Component
@AllArgsConstructor
public class InitPermissionRoles implements CommandLineRunner {

    private final IFunctionService functionService;

    private final IUserService iUserService;

    @Override
    public void run(String... args) {
        functionService.refreshRolesFunctionsCache();
        iUserService.userRoleList();
    }
}
