
package com.lideeyunji.tool.framework.sql.chain;


import com.lideeyunji.tool.framework.sql.entity.SqlInfoEntity;

/**
 * 创建抽象的记录器类。
 */
public abstract class AbstractSQLParser {

    public static int levelStandard = 2;//标准解析
    public static int levelTenant = 1;//租户过滤

    protected int level;
    protected AbstractSQLParser nextSQLParse;//下一个节点解析


    public void setNextSQLParse(AbstractSQLParser nextSQLParse) {
        this.nextSQLParse = nextSQLParse;
    }

    public void processed(int level, SqlInfoEntity sqlInfoEntity) {
        if (this.level <= level) {
            sqlParse(sqlInfoEntity);
        }
        if (nextSQLParse != null) {
            nextSQLParse.processed(level, sqlInfoEntity);
        }
    }


    abstract protected void sqlParse(SqlInfoEntity sqlInfoEntity);

}
