|
@@ -1,8 +1,18 @@
|
|
|
package com.lantone.dblayermbg.facade;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.lantone.common.constant.AuthConstant;
|
|
|
+import com.lantone.common.enums.IsDeleteEnum;
|
|
|
+import com.lantone.common.enums.StatusEnum;
|
|
|
+import com.lantone.common.service.RedisService;
|
|
|
+import com.lantone.dblayermbg.entity.DictionaryInfo;
|
|
|
import com.lantone.dblayermbg.service.impl.DictionaryInfoServiceImpl;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 表名:sys_dictionary_info 业务类
|
|
@@ -11,4 +21,31 @@ import org.springframework.stereotype.Component;
|
|
|
@Component
|
|
|
public class DictionaryInfoFacade extends DictionaryInfoServiceImpl {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisService redisService;
|
|
|
+
|
|
|
+ public Map<Integer, Map<Long, Map<String, String>>> initDic() {
|
|
|
+ QueryWrapper<DictionaryInfo> dictionaryInfoQueryWrapper = new QueryWrapper<DictionaryInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("status", StatusEnum.Enable.getKey())
|
|
|
+ .orderByDesc("order_no");
|
|
|
+ Map<Integer, Map<Long, Map<String, String>>> dicMap = list(dictionaryInfoQueryWrapper)
|
|
|
+ .stream()
|
|
|
+ .collect(
|
|
|
+ Collectors.groupingBy(
|
|
|
+ DictionaryInfo::getReturnType,
|
|
|
+ Collectors.groupingBy(
|
|
|
+ DictionaryInfo::getGroupType,
|
|
|
+ Collectors.toMap(
|
|
|
+ DictionaryInfo::getName,
|
|
|
+ DictionaryInfo::getVal
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )
|
|
|
+ );
|
|
|
+ redisService.del(AuthConstant.DIC_MAP_KEY);
|
|
|
+ redisService.set(AuthConstant.DIC_MAP_KEY, dicMap);
|
|
|
+ return dicMap;
|
|
|
+ }
|
|
|
+
|
|
|
}
|