mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	update 优化 excel导出 下拉框支持顺序
This commit is contained in:
		@@ -16,7 +16,6 @@ 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;
 | 
			
		||||
@@ -103,9 +102,9 @@ public class ExcelDownHandler implements SheetWriteHandler {
 | 
			
		||||
                String converterExp = format.readConverterExp();
 | 
			
		||||
                if (StringUtils.isNotBlank(dictType)) {
 | 
			
		||||
                    // 如果传递了字典名,则依据字典建立下拉
 | 
			
		||||
                    Collection<String> values = Optional.ofNullable(dictService.getDictData(dictType))
 | 
			
		||||
                    Collection<String> values = Optional.ofNullable(dictService.getAllDictByDictType(dictType))
 | 
			
		||||
                        .orElseThrow(() -> new ServiceException(String.format("字典 %s 不存在", dictType)))
 | 
			
		||||
                        .stream().map(DictDataDTO::getDictLabel).toList();
 | 
			
		||||
                        .values();
 | 
			
		||||
                    options = new ArrayList<>(values);
 | 
			
		||||
                } else if (StringUtils.isNotBlank(converterExp)) {
 | 
			
		||||
                    // 如果指定了确切的值,则直接解析确切的值
 | 
			
		||||
 
 | 
			
		||||
@@ -33,10 +33,7 @@ import org.springframework.cache.annotation.Cacheable;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -265,7 +262,12 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
 | 
			
		||||
    @Override
 | 
			
		||||
    public Map<String, String> getAllDictByDictType(String dictType) {
 | 
			
		||||
        List<SysDictDataVo> list = SpringUtils.getAopProxy(this).selectDictDataByType(dictType);
 | 
			
		||||
        return StreamUtils.toMap(list, SysDictDataVo::getDictValue, SysDictDataVo::getDictLabel);
 | 
			
		||||
        // 保证顺序
 | 
			
		||||
        LinkedHashMap<String, String> map = new LinkedHashMap<>();
 | 
			
		||||
        for (SysDictDataVo vo : list) {
 | 
			
		||||
            map.put(vo.getDictValue(), vo.getDictLabel());
 | 
			
		||||
        }
 | 
			
		||||
        return map;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user