package cn.ey.biz.module.system.framework.rule;

import cn.ey.biz.script.BizScript;
import cn.ey.biz.script.BizScriptContext;

import java.util.Map;

public class SimpleRule implements Rule {

    private String script;

    public SimpleRule(String script){
        this.script = script;
    }

    @Override
    public boolean evaluate(Map<String, Object> params) {
        //编译
        BizScript bizScript = BizScript.create(script, null);
        //执行
        BizScriptContext context = new BizScriptContext(params);
        return (boolean)bizScript.execute(context);
    }

}
