mirror of https://gitee.com/xiaonuobase/snowy
【优化】字典tree接口精简冗余字段(sortCode、weight字段合并为sortCode)
parent
58e7d743c4
commit
a6424ca5ba
|
@ -16,7 +16,9 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNode;
|
||||
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.lang.tree.parser.DefaultNodeParser;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
@ -109,7 +111,10 @@ public class DevDictServiceImpl extends ServiceImpl<DevDictMapper, DevDict> impl
|
|||
new TreeNode<>(devDict.getId(), devDict.getParentId(),
|
||||
devDict.getDictLabel(), devDict.getSortCode()).setExtra(JSONUtil.parseObj(devDict)))
|
||||
.collect(Collectors.toList());
|
||||
return TreeUtil.build(treeNodeList, "0");
|
||||
// 精简冗余字段(sortCode、weight字段合并)
|
||||
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
|
||||
treeNodeConfig.setWeightKey("sortCode");
|
||||
return TreeUtil.build(treeNodeList, "0", treeNodeConfig, new DefaultNodeParser<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue