package com.lantone.security.aop;

import com.lantone.security.facade.base.ResourceFacade;
import com.lantone.security.client.MessageService;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description: 资源与角色访问对应关系信息变更统一处理切面
 * @author: rengb
 * @time: 2021/8/26 10:43
 */
@Aspect
@Component
public class ResourceRoleRulesAspect {

    @Autowired
    private MessageService messageService;

    @Pointcut("execution(public * com.lantone.security.web.RoleManagementController.addRole(..))" +
            "||execution(public * com.lantone.security.web.RoleManagementController.deleteRole(..))" +
            "||execution(public * com.lantone.security.web.RoleManagementController.disableRole(..))" +
            "||execution(public * com.lantone.security.web.RoleManagementController.updateRole(..))" +
            "||execution(public * com.lantone.security.web.FuncManagementController.addMenu(..))" +
            "||execution(public * com.lantone.security.web.FuncManagementController.updateMenu(..))" +
            "||execution(public * com.lantone.security.web.FuncManagementController.deleteMenu(..))" +
            "||execution(public * com.lantone.security.web.FuncManagementController.disableMenu(..))" +
            "||execution(public * com.lantone.security.web.HospitalManagementController.addHospital(..))" +
            "||execution(public * com.lantone.security.web.HospitalManagementController.updateHospital(..))" +
            "||execution(public * com.lantone.security.web.HospitalManagementController.disableHospital(..))" +
            "||execution(public * com.lantone.security.web.HospitalManagementController.deleteHospital(..))"
    )
    public void basicInfoChange() {
    }

    @After("basicInfoChange()")
    public void aspectAfter() {
        messageService.redisRefresh("initResourceRolesMap");
    }

}