⬆️ spring boot 2.3.0 | spring cloud hoxton sr5 | mybatis-plus 3.3.2
This commit is contained in:
1 parent
a800457f7a
commit
d90a021659
5 files changed
+17
-9
No files matched your search
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>pigx-cloud-dependencies-parent</artifactId>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<version>Hoxton.SR4</version>
|
||||
<version>Hoxton.SR5</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<properties>
|
||||
<pigx.version>3.9.0-SNAPSHOT</pigx.version>
|
||||
<mybatis-plus.version>3.3.1</mybatis-plus.version>
|
||||
<mybatis-plus.version>3.3.2</mybatis-plus.version>
|
||||
<dynamic-ds.version>3.0.0</dynamic-ds.version>
|
||||
<druid.version>1.1.21</druid.version>
|
||||
<mysql.connector.version>8.0.20</mysql.connector.version>
|
||||
@@ -27,7 +27,7 @@
|
||||
<ijpay.version>1.2.0</ijpay.version>
|
||||
<groovy.version>3.0.3</groovy.version>
|
||||
<security.oauth.version>2.3.6.RELEASE</security.oauth.version>
|
||||
<fastjson.version>1.2.67</fastjson.version>
|
||||
<fastjson.version>1.2.69</fastjson.version>
|
||||
<aliyun.version>3.0.52.ALL</aliyun.version>
|
||||
</properties>
|
||||
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class PigxFeignTenantInterceptor implements RequestInterceptor {
|
||||
@Override
|
||||
public void apply(RequestTemplate requestTemplate) {
|
||||
if (TenantContextHolder.getTenantId() == null) {
|
||||
log.error("TTL 中的 租户ID为空,feign拦截器 >> 增强失败");
|
||||
log.debug("TTL 中的 租户ID为空,feign拦截器 >> 跳过");
|
||||
return;
|
||||
}
|
||||
requestTemplate.header(CommonConstants.TENANT_ID, TenantContextHolder.getTenantId().toString());
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
<description>pigx 动态切换数据源</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-core</artifactId>
|
||||
</dependency>
|
||||
<!--mybatis-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
|
||||
+6
-2
@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.codegen.entity.GenDatasourceConf;
|
||||
import com.pig4cloud.pigx.codegen.mapper.GenDatasourceConfMapper;
|
||||
import com.pig4cloud.pigx.codegen.service.GenDatasourceConfService;
|
||||
import com.pig4cloud.pigx.common.core.util.SpringContextHolder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jasypt.encryption.StringEncryptor;
|
||||
@@ -44,9 +45,8 @@ import java.sql.SQLException;
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class GenDatasourceConfServiceImpl extends ServiceImpl<GenDatasourceConfMapper, GenDatasourceConf> implements GenDatasourceConfService {
|
||||
private DynamicRoutingDataSource dynamicRoutingDataSource;
|
||||
private final StringEncryptor stringEncryptor;
|
||||
private DataSourceCreator dataSourceCreator;
|
||||
private final DataSourceCreator dataSourceCreator;
|
||||
|
||||
/**
|
||||
* 保存数据源并且加密
|
||||
@@ -82,6 +82,7 @@ public class GenDatasourceConfServiceImpl extends ServiceImpl<GenDatasourceConfM
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
//先移除
|
||||
DynamicRoutingDataSource dynamicRoutingDataSource = SpringContextHolder.getBean(DynamicRoutingDataSource.class);
|
||||
dynamicRoutingDataSource.removeDataSource(
|
||||
baseMapper.selectById(conf.getId()).getName());
|
||||
|
||||
@@ -105,6 +106,7 @@ public class GenDatasourceConfServiceImpl extends ServiceImpl<GenDatasourceConfM
|
||||
*/
|
||||
@Override
|
||||
public Boolean removeByDsId(Integer dsId) {
|
||||
DynamicRoutingDataSource dynamicRoutingDataSource = SpringContextHolder.getBean(DynamicRoutingDataSource.class);
|
||||
dynamicRoutingDataSource.removeDataSource(
|
||||
baseMapper.selectById(dsId).getName());
|
||||
this.baseMapper.deleteById(dsId);
|
||||
@@ -124,6 +126,8 @@ public class GenDatasourceConfServiceImpl extends ServiceImpl<GenDatasourceConfM
|
||||
dataSourceProperty.setUsername(conf.getUsername());
|
||||
dataSourceProperty.setPassword(conf.getPassword());
|
||||
DataSource dataSource = dataSourceCreator.createDataSource(dataSourceProperty);
|
||||
|
||||
DynamicRoutingDataSource dynamicRoutingDataSource = SpringContextHolder.getBean(DynamicRoutingDataSource.class);
|
||||
dynamicRoutingDataSource.addDataSource(dataSourceProperty.getPollName(), dataSource);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,14 +33,14 @@
|
||||
</organization>
|
||||
|
||||
<properties>
|
||||
<spring-boot.version>2.2.7.RELEASE</spring-boot.version>
|
||||
<spring-cloud.version>Hoxton.SR4</spring-cloud.version>
|
||||
<spring-boot.version>2.3.0.RELEASE</spring-boot.version>
|
||||
<spring-cloud.version>Hoxton.SR5</spring-cloud.version>
|
||||
<spring-cloud-alibaba.version>2.2.1.RELEASE</spring-cloud-alibaba.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<spring-boot-admin.version>2.2.3</spring-boot-admin.version>
|
||||
<hutool.version>5.3.3</hutool.version>
|
||||
<hutool.version>5.3.6</hutool.version>
|
||||
<kaptcha.version>1.2.0</kaptcha.version>
|
||||
<swagger.fox.version>2.9.2</swagger.fox.version>
|
||||
<knife4j.version>2.0.3</knife4j.version>
|
||||
|
||||
Reference in new issue
Block a user