提交 89237f7d 编写于 作者: xignzi006's avatar xignzi006 🇨🇳

更新 SaaSTenantHandler.java.ftl

上级 ae360afa
A <#ibiztemplate>
\ No newline at end of file TARGET=PSSYSTEM
</#ibiztemplate>
<#if sys.getSaaSMode()==1>
package ${pub.getPKGCodeName()}.core.util.config;
import ${pub.getPKGCodeName()}.util.security.AuthenticationUser;
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.StringValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@EnableConfigurationProperties(SaaSTenantProperties.class)
public class SaaSTenantHandler implements TenantHandler {
@Autowired
private SaaSTenantProperties saaSTenantProperties;
@Override
public Expression getTenantId(boolean where) {
AuthenticationUser user = AuthenticationUser.getAuthenticationUser();
return new StringValue(user.getDomain());
}
@Override
public String getTenantIdColumn() {
return saaSTenantProperties.getColumn();
}
@Override
public boolean doTableFilter(String tableName) {
tableName = tableName.replace("`","") ;
if (saaSTenantProperties.getSysTables().contains(tableName))
return true;
return false;
}
}
</#if>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册