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

This commit is contained in:
疯狂的狮子Li 2025-03-21 13:53:23 +08:00
parent 33698ee448
commit 5de1ffff90

View File

@ -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)) {
// 如果指定了确切的值则直接解析确切的值