private String[] querkFather() { String sql = "select pk_org from org_orgs start with pk_fatherorg =‘XXXXX‘ connect by prior pk_org=pk_fatherorg"; IUAPQueryBS bs = NCLocator.getInstance().lookup(IUAPQueryBS.class); try { List list = (List) bs.executeQuery(sql, new MapListProcessor()); List<String> list1 = new ArrayList<String>(); for (Object object : list) { Map map = (Map) object; list1.add((String) map.get("pk_org")); } return list1.toArray(new String[0]); } catch (Exception e) { e.printStackTrace(); } return null; }
获得SQL的查询结果,遍历查询结果。定义一个ArrayList,用Map取值,并存放到list中。最后return String[list]
时间: 2024-12-09 03:07:22