package org.jeecg.config.mybatis.interceptor;

import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.schema.Table;

public class TenantLineInnerInterceptor extends com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor {

    public TenantLineInnerInterceptor(TenantLineHandler tenantLineHandler) {
        super(tenantLineHandler);
    }

    @Override
    public Expression buildTableExpression(Table table, Expression where, String whereSegment) {
        Expression tenantId = this.getTenantLineHandler().getTenantId();
        if (tenantId.toString().equals("0")) {
            return null;
        }
        return super.buildTableExpression(table, where, whereSegment);
    }
}


