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