|
|
|
@@ -0,0 +1,74 @@ |
|
|
|
package com.iformall.tenant; |
|
|
|
|
|
|
|
import com.iformall.plugin.TenantInfo; |
|
|
|
import com.iformall.shiro.UserSession; |
|
|
|
import org.apache.ibatis.mapping.MappedStatement; |
|
|
|
import org.apache.shiro.SecurityUtils; |
|
|
|
import org.apache.shiro.session.InvalidSessionException; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
public class TenantInfoImpl implements TenantInfo { |
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Override |
|
|
|
public String getTenantId() { |
|
|
|
String tenantId = ""; |
|
|
|
try { |
|
|
|
tenantId = (String) SecurityUtils.getSubject().getSession().getAttribute(UserSession.tenantId); |
|
|
|
} catch (InvalidSessionException e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
} |
|
|
|
return tenantId; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean doTableFilter(String tableName) { |
|
|
|
if ("mall_permission".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if ("mall_user_role".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if ("wx_channel".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if ("wx_business".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if ("wx_coupon_type".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if ("wx_game_template".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if ("wx_group".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if ("wx_mall_apply".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if ("wx_tags".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if ("wx_tags_group".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if ("wx_tags_type".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if ("wx_user_channel".equals(tableName)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
// wx_profit_sharing_receiver |
|
|
|
// wx_profit_sharing_result |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean doMappedStatementFIlter(MappedStatement ms) { |
|
|
|
if ("com.iformall.mapper.MallUserInfoMapper.selectByUserName".equals(ms.getId())) |
|
|
|
return true; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |