✨ 添加新特性:: 租户管理功能
This commit is contained in:
1 parent
c38a8cbbc8
commit
a841d13c74
40 files changed
+824
-133
No files matched your search
+21
@@ -0,0 +1,21 @@
|
||||
package com.pig4cloud.pigx.codegen.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019-05-14
|
||||
* <p>
|
||||
* 参考DruidDataSourceWrapper
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties("spring.datasource.druid")
|
||||
public class DruidDataSourceProperties {
|
||||
private String username;
|
||||
private String password;
|
||||
private String url;
|
||||
private String driverClassName;
|
||||
}
|
||||
+6
-7
@@ -1,12 +1,11 @@
|
||||
package com.pig4cloud.pigx.codegen.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.mysql.cj.jdbc.Driver;
|
||||
import com.pig4cloud.pigx.codegen.util.DataSourceConstants;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jasypt.encryption.StringEncryptor;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@@ -32,14 +31,14 @@ import java.util.Optional;
|
||||
@AllArgsConstructor
|
||||
public class DynamicDataSourceConfig implements TransactionManagementConfigurer {
|
||||
private final Map<Object, Object> dataSourceMap = new HashMap<>(8);
|
||||
private final DataSourceProperties dataSourceProperties;
|
||||
private final DruidDataSourceProperties dataSourceProperties;
|
||||
private final StringEncryptor stringEncryptor;
|
||||
|
||||
@Bean("dynamicDataSource")
|
||||
public DynamicDataSource dataSource() {
|
||||
DynamicDataSource ds = new DynamicDataSource();
|
||||
HikariDataSource cads = new HikariDataSource();
|
||||
cads.setJdbcUrl(dataSourceProperties.getUrl());
|
||||
DruidDataSource cads = new DruidDataSource();
|
||||
cads.setUrl(dataSourceProperties.getUrl());
|
||||
cads.setDriverClassName(dataSourceProperties.getDriverClassName());
|
||||
cads.setUsername(dataSourceProperties.getUsername());
|
||||
cads.setPassword(dataSourceProperties.getPassword());
|
||||
@@ -64,8 +63,8 @@ public class DynamicDataSourceConfig implements TransactionManagementConfigurer
|
||||
log.info("开始 -> 初始化动态数据源");
|
||||
Optional.of(dbList).ifPresent(list -> list.forEach(db -> {
|
||||
log.info("数据源:{}", db.get(DataSourceConstants.DS_NAME));
|
||||
HikariDataSource ds = new HikariDataSource();
|
||||
ds.setJdbcUrl(String.valueOf(db.get(DataSourceConstants.DS_JDBC_URL)));
|
||||
DruidDataSource ds = new DruidDataSource();
|
||||
ds.setUrl(String.valueOf(db.get(DataSourceConstants.DS_JDBC_URL)));
|
||||
ds.setDriverClassName(Driver.class.getName());
|
||||
ds.setUsername((String) db.get(DataSourceConstants.DS_USER_NAME));
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
this.page.total = response.data.data.total
|
||||
this.tableLoading = false
|
||||
}).catch(() => {
|
||||
this.listLoading=false
|
||||
this.tableLoading=false
|
||||
})
|
||||
},
|
||||
rowDel: function (row, index) {
|
||||
|
||||
Reference in new issue
Block a user