use of com.hccake.ballcat.system.model.vo.DictDataVO in project ballcat by ballcat-projects.
the class SysDictManager method queryDictDataAndHashVO.
/**
* 查询字典数据
* @param dictCodes 字典标识
* @return DictDataAndHashVO
*/
public List<DictDataVO> queryDictDataAndHashVO(String[] dictCodes) {
List<DictDataVO> list = new ArrayList<>();
// 查询对应hash值,以及字典项数据
List<SysDict> sysDictList = sysDictService.listByCodes(dictCodes);
if (CollectionUtil.isNotEmpty(sysDictList)) {
for (SysDict sysDict : sysDictList) {
List<SysDictItem> dictItems = sysDictItemService.listByDictCode(sysDict.getCode());
// 排序并转换为VO
List<DictItemVO> setDictItems = dictItems.stream().sorted(Comparator.comparingInt(SysDictItem::getSort)).map(SysDictItemConverter.INSTANCE::poToItemVo).collect(Collectors.toList());
// 组装DataVO
DictDataVO dictDataVO = new DictDataVO();
dictDataVO.setValueType(sysDict.getValueType());
dictDataVO.setDictCode(sysDict.getCode());
dictDataVO.setHashCode(sysDict.getHashCode());
dictDataVO.setDictItems(setDictItems);
list.add(dictDataVO);
}
}
return list;
}
Aggregations