1. 程式人生 > 實用技巧 >EAS 根據組織獲取它所在的公司

EAS 根據組織獲取它所在的公司

 1 //找公司
 2 String sql2 = "select fid from T_ORG_ADMIN where FORGTYPESTR LIKE '%Company%' and fid =?";
 3 IRowSet irow = DbUtil.executeQuery(ctx, sql2, new Object[] {str});
 4 if (irow.size() == 0) {
 5     String str2 = null;
 6     while (irow.size() == 0) {
 7         String sql3 = "SELECT FPARENTID  FROM T_ORG_ADMIN where FID =?";
8 IRowSet irowSet = DbUtil.executeQuery(ctx, sql3, new Object[] {str}); 9 try { 10 while (irowSet.next()) { 11 str2 = irowSet.getString("FPARENTID"); 12 } 13 } catch (SQLException e) { 14 // TODO Auto-generated catch block 15
e.printStackTrace(); 16 } 17 String sql4 = "select fid from T_ORG_ADMIN where FORGTYPESTR LIKE '%Company%' and fid =?"; 18 irow = DbUtil.executeQuery(ctx, sql4, new Object[] {str2}); 19 } 20 return str2; 21 }else { 22 String id = null; 23 try { 24
while (irow.next()) { 25 id = irow.getString("fid"); 26 } 27 } catch (SQLException e) { 28 // TODO Auto-generated catch block 29 e.printStackTrace(); 30 } 31 return id; 32 }