diff --git a/src/main/java/neatlogic/module/tenant/api/matrix/MatrixColumnDataSearchForSelectApi.java b/src/main/java/neatlogic/module/tenant/api/matrix/MatrixColumnDataSearchForSelectApi.java index 4da038906be449352d408c847a41ac1903bb8eac..5f757ba78c6b812ba6a15042d2fee5700495ef9e 100644 --- a/src/main/java/neatlogic/module/tenant/api/matrix/MatrixColumnDataSearchForSelectApi.java +++ b/src/main/java/neatlogic/module/tenant/api/matrix/MatrixColumnDataSearchForSelectApi.java @@ -332,7 +332,7 @@ public class MatrixColumnDataSearchForSelectApi extends PrivateApiComponentBase currentPage++; dataVo.setCurrentPage(currentPage); List> dataList = matrixDataSourceHandler.searchTableDataNew(dataVo); - List list = deduplicateData(previousPageList, valueField, dataList); + List list = deduplicateData(previousPageList, valueField, textField, dataList); if (currentPage >= startPage) { valueList.addAll(list); } @@ -343,18 +343,21 @@ public class MatrixColumnDataSearchForSelectApi extends PrivateApiComponentBase dataVo.setIsDistinct(false); dataVo.setColumnList(columnList); dataVo.setNotNullColumnList(new ArrayList<>(notNullColumnSet)); - List defaultValueFilterList = new ArrayList<>(); + dataVo.setDefaultValue(null); + dataVo.setPageSize(1); for (String value : valueList) { + List defaultValueFilterList = new ArrayList<>(); MatrixDefaultValueFilterVo matrixDefaultValueFilterVo = new MatrixDefaultValueFilterVo( new MatrixKeywordFilterVo(valueField, SearchExpression.EQ.getExpression(), value), - null + new MatrixKeywordFilterVo(textField, SearchExpression.NOTNULL.getExpression(), null) ); defaultValueFilterList.add(matrixDefaultValueFilterVo); + dataVo.setDefaultValueFilterList(defaultValueFilterList); + List> dataList = matrixDataSourceHandler.searchTableDataNew(dataVo); + if (CollectionUtils.isNotEmpty(dataList)) { + resultList.add(dataList.get(0)); + } } - dataVo.setDefaultValueFilterList(defaultValueFilterList); - dataVo.setDefaultValue(null); - dataVo.setPageSize(1); - resultList = matrixDataSourceHandler.searchTableDataNew(dataVo); } JSONArray dataList = new JSONArray(); if (CollectionUtils.isNotEmpty(resultList)) { @@ -477,7 +480,7 @@ public class MatrixColumnDataSearchForSelectApi extends PrivateApiComponentBase * @param valueField * @param dataList */ - private List deduplicateData(List previousPageList, String valueField, List> dataList) { + private List deduplicateData(List previousPageList, String valueField, String textField, List> dataList) { List resultList = new ArrayList<>(); for (Map resultObj : dataList) { JSONObject firstObj = resultObj.get(valueField); @@ -485,9 +488,20 @@ public class MatrixColumnDataSearchForSelectApi extends PrivateApiComponentBase continue; } String value = firstObj.getString("value"); + if (StringUtils.isBlank(value)) { + continue; + } if (previousPageList.contains(value)) { continue; } + JSONObject secondObj = resultObj.get(textField); + if (MapUtils.isEmpty(secondObj)) { + continue; + } + String text = secondObj.getString("text"); + if (StringUtils.isBlank(text)) { + continue; + } previousPageList.add(value); resultList.add(value); }