fix: db2 分页问题

This commit is contained in:
taojinlong 2021-12-29 18:32:23 +08:00
commit 55a08f61d2
3 changed files with 8 additions and 6 deletions

View File

@ -76,7 +76,7 @@ public class Db2QueryProvider extends QueryProvider {
@Override
public String createSQLPreview(String sql, String orderBy) {
return sqlFix(sql) + " fetch first 1000 rows only;";
return "SELECT * FROM (" + sqlFix(sql) + ") DE_TMP " + " fetch first 1000 rows only;";
}
@Override
@ -140,6 +140,12 @@ public class Db2QueryProvider extends QueryProvider {
st_sql.add("isGroup", isGroup);
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
return st_sql.render();
}

View File

@ -648,7 +648,6 @@ public class DataSetTableService {
datasourceRequest.setPreviewData(true);
try {
datasourceRequest.setPageable(true);
System.out.println(datasourceRequest.getQuery());
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
logger.error(e.getMessage());
@ -1551,11 +1550,8 @@ public class DataSetTableService {
List<String> originNameList = new ArrayList<>();
for (int i = 0; i < fields.size(); i++) {
TableFiled filed = fields.get(i);
System.out.println(new Gson().toJson(filed));
originNameList.add(filed.getFieldName());
DatasetTableField datasetTableField = DatasetTableField.builder().build();
// 物理字段名设定为唯一查询当前数据集下是否已存在该字段存在则update不存在则insert
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
// 字段名一致认为字段没有改变

View File

@ -56,7 +56,7 @@
<el-tab-pane v-if="table.mode === 1 && (table.type === 'excel' || table.type === 'db' || table.type === 'sql')" :label="$t('dataset.update_info')" name="updateInfo">
<update-info v-if="tabActive=='updateInfo'" :param="param" :table="table" />
</el-tab-pane>
<el-tab-pane v-if="isPluginLoaded" :lazy="true" :label="$t('dataset.row_permissions')" name="rowPermissions">
<el-tab-pane v-if="isPluginLoaded && hasDataPermission('manage',param.privileges)" :lazy="true" :label="$t('dataset.row_permissions')" name="rowPermissions">
<plugin-com v-if="isPluginLoaded && tabActive=='rowPermissions'" ref="RowPermissions" component-name="RowPermissions" :obj="table"/>
</el-tab-pane>
</el-tabs>