mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-11 05:19:00 +08:00
feat(codegen): 修改数据源表和列查询接口返回完整对象
- 将`queryTableList`和`queryTableColumn`返回值从字符串列表改为完整的`Table`和`Column`对象 - 移除`GenDsConfController`的`@Inner`注解限制
This commit is contained in:
1 parent
c303196fe7
commit
7f79e077d1
3 files changed
+7
-8
No files matched your search
-2
@@ -28,7 +28,6 @@ import com.pig4cloud.pigx.codegen.entity.GenDatasourceConf;
|
||||
import com.pig4cloud.pigx.codegen.service.GenDatasourceConfService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.core.util.SpringContextHolder;
|
||||
import com.pig4cloud.pigx.common.security.annotation.Inner;
|
||||
import com.pig4cloud.pigx.common.xss.core.XssCleanIgnore;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -72,7 +71,6 @@ public class GenDsConfController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@Inner(value = false)
|
||||
public R list() {
|
||||
return R.ok(datasourceConfService.list());
|
||||
}
|
||||
|
||||
+3
-2
@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.codegen.entity.GenTable;
|
||||
import org.anyline.metadata.Column;
|
||||
import org.anyline.metadata.Table;
|
||||
|
||||
import java.util.List;
|
||||
@@ -68,7 +69,7 @@ public interface GenTableService extends IService<GenTable> {
|
||||
* @param dsName 数据源名称
|
||||
* @return table
|
||||
*/
|
||||
List<String> queryTableList(String dsName);
|
||||
List<Table> queryTableList(String dsName);
|
||||
|
||||
/**
|
||||
* 查询表的全部字段
|
||||
@@ -77,6 +78,6 @@ public interface GenTableService extends IService<GenTable> {
|
||||
* @param tableName 表名称
|
||||
* @return column
|
||||
*/
|
||||
List<String> queryTableColumn(String dsName, String tableName);
|
||||
List<Column> queryTableColumn(String dsName, String tableName);
|
||||
|
||||
}
|
||||
+4
-4
@@ -99,11 +99,11 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
|
||||
* @return column
|
||||
*/
|
||||
@Override
|
||||
public List<String> queryTableColumn(String dsName, String tableName) {
|
||||
public List<Column> queryTableColumn(String dsName, String tableName) {
|
||||
// 手动切换数据源
|
||||
DynamicDataSourceContextHolder.push(dsName);
|
||||
CacheProxy.clear();
|
||||
return ServiceProxy.metadata().columns(tableName).values().stream().map(Column::getName).toList();
|
||||
return ServiceProxy.metadata().columns(tableName).values().stream().toList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,11 +151,11 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
|
||||
* @return table
|
||||
*/
|
||||
@Override
|
||||
public List<String> queryTableList(String dsName) {
|
||||
public List<Table> queryTableList(String dsName) {
|
||||
// 手动切换数据源
|
||||
DynamicDataSourceContextHolder.push(dsName);
|
||||
CacheProxy.clear();
|
||||
return ServiceProxy.metadata().tables().values().stream().map(Table::getName).toList();
|
||||
return ServiceProxy.metadata().tables().values().stream().toList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user