mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-12 13:39:01 +08:00
feat(codegen): 支持动态数据源切换功能
- 在GenTableController的export方法中添加DynamicDataSourceContextHolder支持 - 实现根据table参数动态切换数据源功能
This commit is contained in:
1 parent
5a324b75c9
commit
e959811fa2
1 file changed
+3
+3
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
package com.pig4cloud.pigx.codegen.controller;
|
package com.pig4cloud.pigx.codegen.controller;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.pig4cloud.pigx.codegen.entity.GenTable;
|
import com.pig4cloud.pigx.codegen.entity.GenTable;
|
||||||
@@ -179,6 +180,8 @@ public class GenTableController {
|
|||||||
@ResponseExcel
|
@ResponseExcel
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public List<GenTable> export(GenTable table) {
|
public List<GenTable> export(GenTable table) {
|
||||||
|
// 切换至对应数据源
|
||||||
|
DynamicDataSourceContextHolder.push(table.getDsName());
|
||||||
return tableService.list(Wrappers.query(table));
|
return tableService.list(Wrappers.query(table));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user