|
本帖最后由 凯特-姚帅龙 于 2022-4-18 22:56 编辑
JEPaaS低代码平台后端获取数据字典
一、实现思路
通过DictionaryManager操作字典
二、具体操作
获取列表字典:getDicList();获取树形字典:getDicTree();
三、相关代码
- @Autowired
- private DictionaryManager dictionaryManager;
-
- public void doDicMethod() {
- //获取列表数据字典
- List<DictionaryItemVo> dicList = dictionaryManager.getDicList("字典编码", new Query(), false);
- //如果需要用字典编码匹配字典文本项的话,可以封装为map,key为字典code,value为字典text
- HashMap<String, String> dicMap = new HashMap<>();
- for(DictionaryItemVo dicInfo:dicList){
- dicMap.put(dicInfo.getCode(),dicInfo.getText());
- dicInfo.getBackgroundColor();//字典背景颜色
- dicInfo.getCode();//字典code
- dicInfo.getText();//字典text
- dicInfo.getId();//字典ID
- dicInfo.getTextColor();//字典字体颜色
- }
- //获取树形数据字典
- JSONTreeNode dicTree = dictionaryManager.getDicTree("属性字典编码", false);
- dicTree.getId();//树形字典ID
- dicTree.getCode();//树形字典code
- dicTree.getText();//树形字典text
- dicTree.getNodeType();//节点类型
- dicTree.getChildren();//子节点
- dicTree.getParent();//父节点ID
- }
复制代码
四、关键字
获取数据字典,后端系列
|
|