From 4a60f91994d3e1c996b626cf3126fcbec47ba63e Mon Sep 17 00:00:00 2001 From: runphp Date: Wed, 12 Jan 2022 03:42:38 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8A=A0=E8=BD=BD=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E7=BC=93=E5=AD=98=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/system/service/impl/SysDictTypeServiceImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index 78fb8a4..d20fe25 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -1,6 +1,9 @@ package com.ruoyi.system.service.impl; +import java.util.Comparator; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -135,11 +138,11 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService @Override public void loadingDictCache() { - List dictTypeList = dictTypeMapper.selectDictTypeAll(); - for (SysDictType dictType : dictTypeList) - { - List dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType()); - DictUtils.setDictCache(dictType.getDictType(), dictDatas); + SysDictData dictData = new SysDictData(); + dictData.setStatus("0"); + Map> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream().collect(Collectors.groupingBy(SysDictData::getDictType)); + for (Map.Entry> entry: dictDataMap.entrySet()) { + DictUtils.setDictCache(entry.getKey(), entry.getValue().stream().sorted(Comparator.comparing(SysDictData::getDictSort)).collect(Collectors.toList())); } }