当前位置:网站首页>利用放射get 实体对象属性 记录
利用放射get 实体对象属性 记录
2022-06-09 11:21:00 【水脏】
利用放射get 实体对象属性 记录
@PostMapping(value = "/insert")
public void insert() throws java.lang.NoSuchFieldException{
ADOConnection.runTask(sessionFactory -> {
List<EquipmentBean> equipmentlist = sessionFactory.getMapper(EquipmentBeanMapper.class).queryAll();
EquipmentBean topnode = sessionFactory.getMapper(EquipmentBeanMapper.class).findOneByParentId("0");
if (topnode == null) {
return "";
}
List<Tree<String>> treeList = TreeUtil.build(equipmentlist, topnode.getId(), new TreeNodeConfig(),
(treeNode, node) -> {
node.setId(treeNode.getId());
node.setParentId(treeNode.getParentId());
node.setWeight(treeNode.getSort());
node.setName(treeNode.getName());
Field[] fields = ReflectUtil.getFields(EquipmentBean.class);
Class<?> clazz = treeNode.getClass();
try {
// 扩展属性 ...
for (Field field : fields) {
field.setAccessible(true);
if (StrUtil.equalsAny(field.getName(), "id", "parentId")) {
continue;
}
clazz.getDeclaredField(field.getName());
node.putExtra(field.getName(), field.get(treeNode));
System.out.println(field.getName());
}
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
// Map<String, Object> map = BeanUtil.beanToMap(treeNode);
// for (Map.Entry<String, Object> entry : map.entrySet()) {
// node.putExtra(entry.getKey() ,entry.getValue());
// }
// // 扩展属性 ...
// node.putExtra("id", treeNode.getId());
// node.putExtra("dispatchNo", treeNode.getDispatchNo());
// node.putExtra("dataFrom", treeNode.getDataFrom());
});
System.out.println(treeList);
return true;
}, Boolean.class);
}
用到依赖
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.15</version>
</dependency>
边栏推荐
- LR11安装报错:此计算机上缺少vc2005_sp1_with_atl_fix_redist,请安装所有缺少的必要组件,然后重新运行此安装。
- 13.<tag-二叉树和BST基础>lt.450. 删除二叉搜索树中的节点 dbc
- Simple use of GDB
- Suggested collection: concept, classification, value of data standards and analysis of six implementation steps
- Conversion function between string and numeric value in C language
- win10你的组织已关闭自动更新问题怎么解决?
- 06 | 中台落地第一步:企业战略分解及现状调研(Discovery)
- 2021年下半年系统集成项目管理工程师案例分析真题及答案解析
- Relay alphafold! Star pharmaceutical science and technology released a new era of tbind opening molecular protein complex structure prediction
- tag贪心-刷题预备知识-贪心解题方法 + lt.455. 分发饼干 + lt.376. 摆动序列
猜你喜欢

Iphone5s display disabled solution

15 Win32 class library name in WMI

8K resolution 7680*4320

中国科学院院刊 | 包云岗:加速发展关键核心技术,必须把握技术发展的自身规律

07 | 中台落地第二步:企业数字化全景规划(Define)

如何解决存在的1px问题?
![[signalr complete series] Realization of signalr real-time communication in net core](/img/af/4b8bfea6238c646c54352635d5da98.png)
[signalr complete series] Realization of signalr real-time communication in net core

06 | the first step of China Taiwan landing: enterprise strategy decomposition and current situation research (Discovery)

09 | 中台落地第四步:中台的建设与接入(Delivery)

win10你的组织已关闭自动更新问题怎么解决?
随机推荐
[data center stage] 00 opening words data center stage, is it a trap? Or the golden key?
03 | definition of China Taiwan: what are we talking about when we talk about China Taiwan?
HEVC之HM学习01
H3C certified routing switching network senior engineer
【补丁分析】CVE-2016-8610:对导致拒绝服务的“SSL Death Alert”漏洞补丁分析
Aiko ai Frontier promotion (6.9)
系统集成项目管理工程师考试说明
H3C认证网络工程师
12.<tag-二叉树和BST基础>lt.701. 二叉搜索树中的插入操作 dbc
ConfigurationManager姿势快闪
5. bracket generation
H3C认证云计算高级工程师
SIGIR 2022 | CMI: micro video recommendation combining comparative learning and multi interest mining
spark 写入doris太慢方案解决
小米智能摄像机云台Pro如何插入视频监控存储卡
给 Web3 项目的智能合约安全指南
Configurationmanager pose flash
Preparation guide for 2022 soft test information security engineer examination
06 | the first step of China Taiwan landing: enterprise strategy decomposition and current situation research (Discovery)
RestTemplate使用详解及踩坑记录