|
@@ -5,6 +5,7 @@ import com.ruoyi.common.config.datasource.config.DynamicDataSource;
|
|
|
import com.ruoyi.common.config.datasource.config.GenConfig;
|
|
|
import com.ruoyi.common.config.datasource.constant.DataSourceType;
|
|
|
import com.ruoyi.common.config.datasource.utils.AjaxResult;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.system.entity.DataSource;
|
|
|
import com.ruoyi.system.entity.TableInfo;
|
|
|
import com.ruoyi.system.entity.vo.TableInfoVO;
|
|
@@ -16,6 +17,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.awt.print.Book;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -111,14 +113,19 @@ public class DataSourceServiceImpl implements IDataSourceService {
|
|
|
@Override
|
|
|
public List<TableInfo> tableFieldInfo(Map<String, Object> map) {
|
|
|
DataSource dataSource = JSON.parseObject(JSON.toJSONString(map), DataSource.class);
|
|
|
+ List<TableInfo> tableInfoList = new ArrayList<>();
|
|
|
if (dataSource.getDatabaseType().equals(DataSourceType.MYSQL.getDataSourceName())) {
|
|
|
- return tableInfoMapper.mysqlTableFieldInfo(dataSource.getDatabaseName(), map.get("tableName").toString());
|
|
|
+ tableInfoList = tableInfoMapper.mysqlTableFieldInfo(dataSource.getDatabaseName(), map.get("tableName").toString());
|
|
|
} else if (dataSource.getDatabaseType().equals(DataSourceType.SQLSERVER.getDataSourceName())) {
|
|
|
- return tableInfoMapper.sqlserverTableFieldInfo(map.get("tableName").toString());
|
|
|
+ tableInfoList = tableInfoMapper.sqlserverTableFieldInfo(map.get("tableName").toString());
|
|
|
} else if (dataSource.getDatabaseType().equals(DataSourceType.DM.getDataSourceName())) {
|
|
|
- return tableInfoMapper.dmTableFieldInfo(dataSource.getDatabaseName(), map.get("tableName").toString());
|
|
|
+ tableInfoList = tableInfoMapper.dmTableFieldInfo(dataSource.getDatabaseName(), map.get("tableName").toString());
|
|
|
}
|
|
|
- return tableInfoMapper.mysqlTableFieldInfo(dataSource.getDatabaseName(), map.get("tableName").toString());
|
|
|
+ // 将列中的字段属性驼峰转换
|
|
|
+ tableInfoList.forEach(item -> {
|
|
|
+ item.setFieldName(StringUtils.toCamelCase(item.getFieldName()));
|
|
|
+ });
|
|
|
+ return tableInfoList;
|
|
|
}
|
|
|
|
|
|
|