
package com.jeelowcode.framework.plus.core.model;

import java.util.Map;

public class SqlFormatModel {
    private String sql;
    private Map<String,Object> dataMap;

    public SqlFormatModel() {
    }

    public SqlFormatModel(String sql, Map<String, Object> dataMap) {
        this.sql = sql;
        this.dataMap = dataMap;
    }

    public SqlFormatModel(String sql) {
        this.sql = sql;
    }



    public String getSql() {
        return sql;
    }

    public String getEwSql() {
        String replacedSql = sql.replaceAll("(?<!#\\{ew\\.)\\#\\{(\\w+)}", "#{ew.$1}");
        return replacedSql;
    }

    public void setSql(String sql) {
        this.sql = sql;
    }

    public Map<String, Object> getDataMap() {
        return dataMap;
    }

    public void setDataMap(Map<String, Object> dataMap) {
        this.dataMap = dataMap;
    }
}
