mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-23 05:00:23 +08:00
Merge branch 'dev'
This commit is contained in:
commit
d7bc5f822f
@ -17,6 +17,7 @@
|
||||
package com.pig4cloud.pig.common.datasource.config;
|
||||
|
||||
import com.baomidou.dynamic.datasource.processor.DsProcessor;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
/**
|
||||
@ -36,7 +37,12 @@ public class LastParamDsProcessor extends DsProcessor {
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(String key) {
|
||||
return key.startsWith(LAST_PREFIX);
|
||||
if (key.startsWith(LAST_PREFIX)) {
|
||||
// https://github.com/baomidou/dynamic-datasource-spring-boot-starter/issues/213
|
||||
DynamicDataSourceContextHolder.clear();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,6 @@ import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -76,8 +75,6 @@ public class GeneratorServiceImpl implements GeneratorService {
|
||||
List<GenFormConf> formConfList = genFormConfMapper.selectList(Wrappers.<GenFormConf>lambdaQuery()
|
||||
.eq(GenFormConf::getTableName, genConfig.getTableName()).orderByDesc(GenFormConf::getCreateTime));
|
||||
|
||||
DynamicDataSourceContextHolder.push(genConfig.getDsName());
|
||||
|
||||
String tableNames = genConfig.getTableName();
|
||||
for (String tableName : StrUtil.split(tableNames, StrUtil.DASHED)) {
|
||||
// 查询表信息
|
||||
@ -92,6 +89,7 @@ public class GeneratorServiceImpl implements GeneratorService {
|
||||
return CodeGenUtils.generatorCode(genConfig, table, columns, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
return MapUtil.empty();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user