|
|
@@ -1,6 +1,9 @@
|
|
|
package com.cloud.sa.base.module.support.dict.service;
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.cloud.sa.base.module.support.dict.domain.vo.DictCategoryVO;
|
|
|
+import com.cloud.sa.base.module.support.dict.domain.vo.DictKeyVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import com.cloud.sa.base.common.domain.ResponseDTO;
|
|
|
@@ -16,6 +19,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
@@ -128,4 +132,25 @@ public class DictCacheService {
|
|
|
return StringUtils.join(valueNameList, ",");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询数据字典所有key-value
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ * */
|
|
|
+ public ResponseDTO<List<DictCategoryVO>> allDictQuery(){
|
|
|
+ QueryWrapper<DictKeyEntity> qw = new QueryWrapper<>();
|
|
|
+ qw.eq("status", 1).eq("deleted_flag", 0);
|
|
|
+ List<DictKeyVO> dictKeyVOList = BlinkBeanUtil.copyList(dictKeyDao.selectList(qw), DictKeyVO.class);
|
|
|
+ List<DictCategoryVO> dictCategoryVOList = new ArrayList<>();
|
|
|
+ for (DictKeyVO dictKeyVO : dictKeyVOList) {
|
|
|
+ DictCategoryVO dictCategoryVO = new DictCategoryVO();
|
|
|
+ dictCategoryVO.setKey(dictKeyVO);
|
|
|
+ List<DictValueVO> dictValueVOList = DICT_CACHE.getOrDefault(dictKeyVO.getKeyCode(), Lists.newArrayList());
|
|
|
+ dictCategoryVO.setValue(dictValueVOList);
|
|
|
+ dictCategoryVOList.add(dictCategoryVO);
|
|
|
+ }
|
|
|
+ return ResponseDTO.ok(dictCategoryVOList);
|
|
|
+ }
|
|
|
+
|
|
|
}
|