Sfoglia il codice sorgente

update 优化 excel导出 下拉框支持顺序

疯狂的狮子Li 1 mese fa
parent
commit
5de1ffff90

+ 3 - 2
ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/ExcelDownHandler.java

@@ -16,6 +16,7 @@ import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddressList;
 import org.apache.poi.ss.util.WorkbookUtil;
 import org.apache.poi.xssf.usermodel.XSSFDataValidation;
+import org.dromara.common.core.domain.dto.DictDataDTO;
 import org.dromara.common.core.exception.ServiceException;
 import org.dromara.common.core.service.DictService;
 import org.dromara.common.core.utils.SpringUtils;
@@ -102,9 +103,9 @@ public class ExcelDownHandler implements SheetWriteHandler {
                 String converterExp = format.readConverterExp();
                 if (StringUtils.isNotBlank(dictType)) {
                     // 如果传递了字典名,则依据字典建立下拉
-                    Collection<String> values = Optional.ofNullable(dictService.getAllDictByDictType(dictType))
+                    Collection<String> values = Optional.ofNullable(dictService.getDictData(dictType))
                         .orElseThrow(() -> new ServiceException(String.format("字典 %s 不存在", dictType)))
-                        .values();
+                        .stream().map(DictDataDTO::getDictLabel).toList();
                     options = new ArrayList<>(values);
                 } else if (StringUtils.isNotBlank(converterExp)) {
                     // 如果指定了确切的值,则直接解析确切的值