mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 01:25:28 +08:00
h5 动态表单,支持多租户
This commit is contained in:
parent
515b57d561
commit
399e8cbaee
@ -9,8 +9,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean(MybatisPlusConfig.class)
|
||||
@AutoConfiguration(after = {MybatisPlusConfig.class})
|
||||
public class MybatisPlusAutoConfigTenant {
|
||||
|
||||
@Bean
|
||||
|
||||
@ -15,7 +15,7 @@ import org.dromara.common.mybatis.handler.InjectionMetaObjectHandler;
|
||||
import org.dromara.common.mybatis.handler.MybatisExceptionHandler;
|
||||
import org.dromara.common.mybatis.interceptor.PlusDataPermissionInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
@ -31,15 +31,18 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
@Slf4j
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
@Autowired(required = false)
|
||||
private TenantLineInnerInterceptor tenantLineInnerInterceptor;
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
// 多租户插件 必须放到第一位
|
||||
try {
|
||||
TenantLineInnerInterceptor tenant = SpringUtils.getBean(TenantLineInnerInterceptor.class);
|
||||
interceptor.addInnerInterceptor(tenant);
|
||||
} catch (BeansException ignore) {
|
||||
if(tenantLineInnerInterceptor == null){
|
||||
log.warn("MybatisPlus 多租户未打开!");
|
||||
}else {
|
||||
log.info("MybatisPlus 多租户打开!");
|
||||
interceptor.addInnerInterceptor(tenantLineInnerInterceptor);
|
||||
}
|
||||
// 数据权限处理
|
||||
interceptor.addInnerInterceptor(dataPermissionInterceptor());
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
### 查询所有H5项目
|
||||
GET http://localhost:19200/h5/works/page?page=1&size=10
|
||||
GET http://localhost:19200/h5/works/page?page=1&size=10&status=1&isTemplate=true
|
||||
Accept: application/json
|
||||
|
||||
@ -10,7 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@EnableDubbo
|
||||
@SpringBootApplication(scanBasePackages = {"com.luban","com.dromara.md.form"})
|
||||
@SpringBootApplication(scanBasePackages = {"com.luban", "com.dromara.md.form", "org.dromara"})
|
||||
public class MallH5Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@ -9,8 +9,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean(MybatisPlusConfig.class)
|
||||
@AutoConfiguration(after = {MybatisPlusConfig.class})
|
||||
public class MybatisPlusAutoConfigTenant {
|
||||
|
||||
@Bean
|
||||
|
||||
@ -24,6 +24,11 @@ public class PlusTenantLineHandler implements TenantLineHandler {
|
||||
|
||||
private final TenantProperties tenantProperties;
|
||||
|
||||
@Override
|
||||
public String getTenantIdColumn() {
|
||||
return "td";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expression getTenantId() {
|
||||
String tenantId = TenantHelper.getTenantId();
|
||||
|
||||
@ -53,6 +53,8 @@ springdoc:
|
||||
|
||||
# 多租户配置
|
||||
tenant:
|
||||
# 是否开启
|
||||
enable: true
|
||||
# 排除表
|
||||
excludes:
|
||||
- sys_menu
|
||||
@ -89,3 +91,4 @@ logging:
|
||||
config: classpath:logback-plus.xml
|
||||
level:
|
||||
com.baomidou.mybatisplus: debug
|
||||
org.mybatis.spring.mapper: debug
|
||||
|
||||
Loading…
Reference in New Issue
Block a user