public List queryDeviceName(String where) {
Session session = this.getSession();
List list = session.createSQLQuery("select number, name from devrepair " + where).list();
return list;
}
List deviceList = this.getDevrepairService().queryDeviceName(where);
StringBuilder sb = new StringBuilder();
sb.append("{devices:[");
for(Object nameinfo:deviceList){ //查询的结果为Object
sb.append("{number:'").append(((Object[])nameinfo)[0]).append("',"); //将查询结果转化为Object的集合,取值
sb.append("name:'").append(((Object[])nameinfo)[1]).append("'}");
sb.append(",");
}
posted on 2012-09-03 17:25
Jimi 阅读(615)
评论(0) 编辑 收藏