public ResultPend screen(List<Map<String, Object>> pending){ Map<String,Object> maps = new HashMap<>(); for (Map<String, Object> map : pending) { //获取到pending里面的data Object datas = map.get("data"); List<Map<String,Object>> list = (List<Map<String, Object>>) datas; for (Map<String, Object> objectMap : list) { Object processInstName = objectMap.get("processInstName"); maps.put("processInstName",processInstName); Object metadataName = objectMap.get("metadataName"); maps.put("metadataName", metadataName); Object originBusinessName = objectMap.get("originBusinessName"); maps.put("originBusinessName",originBusinessName); Object originatorName = objectMap.get("originatorName"); maps.put("originatorName", originatorName); Object originTime = objectMap.get("originTime"); maps.put("originTime", originTime); Object processDefineName = objectMap.get("processDefineName"); maps.put("processDefineName", processDefineName); Object processNodeInstName = objectMap.get("processNodeInstName"); maps.put("processNodeInstName", processNodeInstName); Object tenantName = objectMap.get("tenantName"); maps.put("tenantName", tenantName); Object enterpriseName = objectMap.get("enterpriseName"); maps.put("enterpriseName", enterpriseName); Object createUserId = objectMap.get("createUserId"); maps.put("createUserId", createUserId); Object createdTime = objectMap.get("createdTime"); maps.put("createdTime",createdTime); } } }怎么把上述代码中的maps集合转成ResultPend对象并返回
时间: 2024-04-12 13:29:01 浏览: 117
要将maps集合转换为ResultPend对象并返回,你需要创建一个ResultPend对象,并将maps中的数据设置到相应的属性中。可以按照以下步骤进行操作:
1. 创建ResultPend对象:
```java
ResultPend resultPend = new ResultPend();
```
2. 从maps中取出数据,并设置到ResultPend对象的属性中:
```java
resultPend.setProcessInstName((String) maps.get("processInstName"));
resultPend.setMetadataName((String) maps.get("metadataName"));
resultPend.setOriginBusinessName((String) maps.get("originBusinessName"));
resultPend.setOriginatorName((String) maps.get("originatorName"));
resultPend.setOriginTime((String) maps.get("originTime"));
resultPend.setProcessDefineName((String) maps.get("processDefineName"));
resultPend.setProcessNodeInstName((String) maps.get("processNodeInstName"));
resultPend.setTenantName((String) maps.get("tenantName"));
resultPend.setEnterpriseName((String) maps.get("enterpriseName"));
resultPend.setCreateUserId((String) maps.get("createUserId"));
resultPend.setCreatedTime((String) maps.get("createdTime"));
```
3. 返回ResultPend对象:
```java
return resultPend;
```
请注意,这里假设ResultPend类已经定义并具有相应的属性和setter方法来设置数据。
阅读全文