@At("/tree/search")
public List treeSearch(String jyzh,String jyrq,String jysj,String jyhm) {
StringBuilder sqls = new StringBuilder("select concat(dfhm,'-账号:',dfzh) name,concat('交易金额:',jyje,'&交易日期:',jyrq,jysj,'&借贷标志:',jyjdbz) value");
StringBuilder cnd = new StringBuilder(" from " + "test" + " where jyzh = @jyzh and jyrq >= @jyrq and jysj >= @jysj order by jyrq,jysj");
Sql sqlss = Sqls.create(sqls.append(cnd).toString());
sqlss.setParam("jyzh", jyzh);
sqlss.setParam("jyrq", jyrq);
sqlss.setParam("jysj", jysj);
sqlss.setCallback(Sqls.callback.records());
dao().execute(sqlss);
List<Record> treeList = sqlss.getList(Record.class);
List<Map<String,Object>> mapList=new ArrayList<Map<String,Object>>();
Map<String,Object> map=new HashMap<String,Object>();
if(treeList!=null && treeList.size()>0){
map.put("name",jyhm+"-账号:"+jyzh);
map.put("value","&");
map.put("children",treeList);
mapList.add(map);
}else{
map.put("name",jyhm+"-账号:"+jyzh);
map.put("value","&");
map.put("children",treeList);
mapList.add(map);
}
return mapList;
}
得到的treeList的结果集为何是这样的呢,将sql语句中的 jyje换成varchar类型就正常,现在是decimal的类型就是这样的
"name": "中证登结有限责任公司上海分公司(备付金)账号:6230582000026676075",
"value": [-28, -70, -92, -26, -104, -109, -23, -121, -111, -23, -94, -99, 58, 57, 49, 48, 53, 52, 46, 48, 55, 38, -28, -70, -92, -26, -104, -109, -26, -105, -91, -26, -100, -97, 58, 50, 48, 49, 56, 48, 50, 50, 53, 49, 50, 49, 57, 51, 49, 38, -27, -128, -97, -24, -76, -73, -26, -96, -121, -27, -65, -105, 58, -27, -128, -97]
}]