修改获取tenantID的顺序
This commit is contained in:
@@ -40,22 +40,23 @@ public class MybatisPlusConfig {
|
||||
|
||||
@Override
|
||||
public Expression getTenantId() {
|
||||
String tenantId;
|
||||
// 从请求头拿ID
|
||||
tenantId = request.getHeader("tenantId");
|
||||
if(tenantId != null){
|
||||
System.out.println("从请求头拿ID = " + tenantId);
|
||||
return new LongValue(tenantId);
|
||||
}
|
||||
// 从域名拿ID
|
||||
String Domain = request.getHeader("Domain");
|
||||
if (StrUtil.isNotBlank(Domain)) {
|
||||
String key = "Domain:" + Domain;
|
||||
String tenantId = redisUtil.get(key);
|
||||
tenantId = redisUtil.get(key);
|
||||
if(tenantId != null){
|
||||
System.out.println("授权域名" + Domain + " => " + tenantId);
|
||||
return new LongValue(tenantId);
|
||||
}
|
||||
}
|
||||
// 从请求头拿ID
|
||||
final String tenantId = request.getHeader("tenantId");
|
||||
if(tenantId != null){
|
||||
System.out.println("从请求头拿ID = " + tenantId);
|
||||
return new LongValue(tenantId);
|
||||
}
|
||||
return getLoginUserTenantId();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
Reference in New Issue
Block a user