package com.engine.salary.formlua.core;

import com.engine.salary.formlua.entity.standard.ExcelResult;
import com.ql.util.express.DefaultContext;
import com.ql.util.express.ExpressRunner;

import java.util.HashMap;
import java.util.Map;

/**
 * 执行业务类
 */
public class QlExpressTest {
    private static ExpressRunner runner = new ExpressRunner(true, false);

    public static void main(String[] args) throws Exception {
        QlExpress express = new QlExpress();
        Map<String, Object> context = new HashMap<>();
        context.put("a", 1);
        context.put("b", 2);
        String formula = "IF(a>b,a,b)";
        ExcelResult execute = express.execute(formula, context);
        System.out.println(execute.getData());



        DefaultContext<String, Object> context2 = new DefaultContext<String, Object>();
        context2.put("a", 1);
        context2.put("b", 2);
        Object data = runner.execute("if(a>b){a}else{b}", context2, null, true, false);
        System.out.println(data.toString());
    }
}
