mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-11 05:19:00 +08:00
Merge remote-tracking branch 'origin/leng_dev' into leng_dev
This commit is contained in:
commit
f68a0fa655
357 files changed
+54570
-3442
No files matched your search
+7
-7
@@ -1,7 +1,7 @@
|
||||
package com.pig4cloud.pigx.codegen.config;
|
||||
|
||||
import com.mysql.cj.jdbc.Driver;
|
||||
import com.pig4cloud.pigx.codegen.util.DataSourceConstant;
|
||||
import com.pig4cloud.pigx.codegen.util.DataSourceConstants;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -60,18 +60,18 @@ public class DynamicDataSourceConfig implements TransactionManagementConfigurer
|
||||
dds.setUsername(dataSourceProperties.getUsername());
|
||||
dds.setPassword(dataSourceProperties.getPassword());
|
||||
|
||||
List<Map<String, Object>> dbList = new JdbcTemplate(dds).queryForList(DataSourceConstant.QUERY_DS_SQL);
|
||||
List<Map<String, Object>> dbList = new JdbcTemplate(dds).queryForList(DataSourceConstants.QUERY_DS_SQL);
|
||||
log.info("开始 -> 初始化动态数据源");
|
||||
Optional.of(dbList).ifPresent(list -> list.forEach(db -> {
|
||||
log.info("数据源:{}", db.get(DataSourceConstant.DS_NAME));
|
||||
log.info("数据源:{}", db.get(DataSourceConstants.DS_NAME));
|
||||
HikariDataSource ds = new HikariDataSource();
|
||||
ds.setJdbcUrl(String.valueOf(db.get(DataSourceConstant.DS_JDBC_URL)));
|
||||
ds.setJdbcUrl(String.valueOf(db.get(DataSourceConstants.DS_JDBC_URL)));
|
||||
ds.setDriverClassName(Driver.class.getName());
|
||||
ds.setUsername((String) db.get(DataSourceConstant.DS_USER_NAME));
|
||||
ds.setUsername((String) db.get(DataSourceConstants.DS_USER_NAME));
|
||||
|
||||
String decPwd = stringEncryptor.decrypt((String) db.get(DataSourceConstant.DS_USER_PWD));
|
||||
String decPwd = stringEncryptor.decrypt((String) db.get(DataSourceConstants.DS_USER_PWD));
|
||||
ds.setPassword(decPwd);
|
||||
dataSourceMap.put(db.get(DataSourceConstant.DS_ROUTE_KEY), ds);
|
||||
dataSourceMap.put(db.get(DataSourceConstants.DS_ROUTE_KEY), ds);
|
||||
}));
|
||||
|
||||
log.info("完毕 -> 初始化动态数据源,共计 {} 条", dataSourceMap.size());
|
||||
|
||||
-2
@@ -21,7 +21,6 @@ import cn.hutool.core.io.IoUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.codegen.entity.GenConfig;
|
||||
import com.pig4cloud.pigx.codegen.mapper.SysDatasourceConfMapper;
|
||||
import com.pig4cloud.pigx.codegen.mapper.SysGeneratorMapper;
|
||||
import com.pig4cloud.pigx.codegen.service.SysGeneratorService;
|
||||
import com.pig4cloud.pigx.codegen.util.DynamicDataSourceContextHolder;
|
||||
@@ -43,7 +42,6 @@ import java.util.zip.ZipOutputStream;
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SysGeneratorServiceImpl implements SysGeneratorService {
|
||||
private final SysDatasourceConfMapper sysDatasourceConfMapper;
|
||||
private final SysGeneratorMapper sysGeneratorMapper;
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ package com.pig4cloud.pigx.codegen.util;
|
||||
* <p>
|
||||
* 数据源相关常量
|
||||
*/
|
||||
public interface DataSourceConstant {
|
||||
public interface DataSourceConstants {
|
||||
/**
|
||||
* 查询数据源的SQL
|
||||
*/
|
||||
@@ -4,22 +4,13 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#配置中心
|
||||
cloud:
|
||||
config:
|
||||
fail-fast: true
|
||||
name: ${spring.application.name}
|
||||
profile: ${spring.profiles.active}
|
||||
nacos:
|
||||
discovery:
|
||||
enabled: true
|
||||
service-id: pigx-config
|
||||
server-addr: ${NACOS-HOST:pigx-register}:${NACOS-PORT:8848}
|
||||
config:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yml
|
||||
shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
profiles:
|
||||
active: dev
|
||||
|
||||
# 注册中心配置
|
||||
eureka:
|
||||
instance:
|
||||
prefer-ip-address: true
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: http://pig:pig@${EUREKA-HOST:pigx-eureka}:${EUREKA-PORT:8761}/eureka/
|
||||
active: dev
|
||||
@@ -145,7 +145,7 @@
|
||||
* 搜索回调
|
||||
*/
|
||||
searchChange(form) {
|
||||
this.getList(this.page, form)
|
||||
this.getList(this.page, this.filterForm(form))
|
||||
},
|
||||
/**
|
||||
* 刷新回调
|
||||
|
||||
Reference in new issue
Block a user