Map<String, Object> khbzMap = new HashMap<String, Object>();
if(selectList.size() > 0){
for(int i = 0;i< selectList.size();i++){
khbzMap.put("GUIDELINEPFBZ",selectList.get(i).get("GUIDELINEPFBZ") == null ? "" : selectList.get(i).get("GUIDELINEPFBZ"));
Map<String, Object> responseMap = formatResponseMap(khbzMap);
String GUIDELINEPFBZ = responseMap.get("GUIDELINEPFBZ") == null ? "" : responseMap.get("GUIDELINEPFBZ").toString();
selectList.get(i).put("GUIDELINEPFBZ", GUIDELINEPFBZ);
}
}
return JSONArray.fromObject(selectList).toString();
public Map<String, Object> formatResponseMap(Map<String, Object> map) {
Set<String> set = map.keySet();
for (Iterator<String> iterator = set.iterator(); iterator.hasNext();) {
String key = iterator.next();
// 判断数据是否是CLOB如果是对字段进行处理
// 2018-01-12 09:56:14 CLOB 修改为Clob 解决框架更换Druid连接池导出CLOB解析错误问题
if (map.get(key) instanceof Clob) {
Clob clob = (Clob) map.get(key);
try {
map.put(key, clob.getSubString((long) 1, (int) clob.length()));
} catch (SQLException e) {
e.printStackTrace();
}
}
if (map.get(key) instanceof CLOB) {
CLOB clob = (CLOB) map.get(key);
try {
map.put(key, clob.getSubString((long) 1, (int) clob.length()));
} catch (SQLException e) {
e.printStackTrace();
}
}
}
return map;
}
查询结果集List<Map<string,Object>>中CLOB字段转换字符号串
最新推荐文章于 2022-01-18 16:53:47 发布