

package com.lideeyunji.module.biz.enhance;

import com.lideeyunji.core.framework.config.aspect.enhance.model.EnhanceContext;
import com.lideeyunji.core.framework.config.aspect.enhance.model.EnhanceParam;
import com.lideeyunji.core.framework.config.aspect.enhance.plugin.BeforeAdvicePlugin;
import com.lideeyunji.core.framework.utils.Func;
import com.lideeyunji.tool.framework.exception.lideeYunJiException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 前置增强
 */
@Component
@Slf4j
public class MyBeforEnhance implements BeforeAdvicePlugin {
    @Override
    public void execute(EnhanceContext enhanceContext) {
        EnhanceParam param = enhanceContext.getParam();
        Map<String, Object> params = param.getParams();
        String name = Func.getMap2Str(params, "name");
        if(Func.isEmpty(name)){
            throw new lideeYunJiException("参数不允许为空");
        }
    }
}
