优化导出Excel时设置dictType属性重复查缓存问题

pull/448/MERGE
RuoYi 2 years ago
parent f67600df28
commit 466d8800fc

@ -98,6 +98,11 @@ public class ExcelUtil<T>
public static final String[] FORMULA_STR = { "=", "-", "+", "@" }; public static final String[] FORMULA_STR = { "=", "-", "+", "@" };
/**
* dictType
*/
public Map<String, String> sysDictMap = new HashMap<String, String>();
/** /**
* Excel sheet65536 * Excel sheet65536
*/ */
@ -1034,7 +1039,12 @@ public class ExcelUtil<T>
} }
else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value)) else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value))
{ {
cell.setCellValue(convertDictByExp(Convert.toStr(value), dictType, separator)); if (!sysDictMap.containsKey(dictType + value))
{
String lable = convertDictByExp(Convert.toStr(value), dictType, separator);
sysDictMap.put(dictType + value, lable);
}
cell.setCellValue(sysDictMap.get(dictType + value));
} }
else if (value instanceof BigDecimal && -1 != attr.scale()) else if (value instanceof BigDecimal && -1 != attr.scale())
{ {

Loading…
Cancel
Save