遍历取数据库字段值

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

String department = StringUtil.getString(paramMap.get("deptCode"));
String tencentdeptid = null;
String sql = "select BY3 from usr_api.t_xg_dw where DWDM = ?";
List<Map<String, Object>> SSList = null;
try {
SSList = DbUtil.query(sql, new Object[] { department });
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (SSList != null) {
for (Iterator iterators = SSList.iterator(); iterators.hasNext();) {
String GHvalue = null;
Map<String, Object> example = (Map<String, Object>) iterators.next();// 获取当前遍历的元素,指定为Example对象
Iterator entries = example.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry entry = (Map.Entry) entries.next();
Object key = entry.getKey();
Object value = entry.getValue();
if (key.equals("BY3")) {
tencentdeptid = value.toString();
}
}
}
}

本文地址:https://tonysteven.github.io/2018/09/13/List-get-value/
转载请注明出处,谢谢!

坚持原创技术分享,您的支持将鼓励我继续创作!