private void reviseBack(Context ctx,String billId) throws SQLException{ String sql = "select t.FSrcObjectID from T_BOT_RELATION t where t.FDestObjectID='"+billId+"'"; String tableName =""; try { IRowSet rowSet = DbUtil.executeQuery(ctx, sql); while (rowSet.next()) { String sourceFid = rowSet.getString("FSrcObjectID"); BOSObjectType bosType = BizCollUtil.getBOSType(sourceFid); IMetaDataLoader metaDataLoader = MetaDataLoaderFactory.getLocalMetaDataLoader(ctx); EntityObjectInfo bo = metaDataLoader.getEntity(bosType); tableName = bo.getTable().getName(); } if (!EmptyUtil.isEmpty(tableName)) { String upSql = "update "+tableName+" set FSTATE = 60 where fid in ("+sql+")"; DbUtil.execute(ctx, upSql); } } catch (BOSException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
获取可以根据bosType来获取对应的实体对象,再比较选择不同的实体,进行不同的业务
public boolean getAmountControlType(Context ctx, String sourceBillId) throws BOSException { BOSObjectType type = BizCollUtil.getBOSType(sourceBillId); StringBuffer sql = new StringBuffer(); int controltype = 0; if((new OtherExpenseBillInfo()).getBOSType().equals(type)) sql = sql.append("select famountcontroltype from T_BC_OtherExpenseBill where fid=? "); else if((new DailyLoanBillInfo()).getBOSType().equals(type)) sql = sql.append("select famountcontroltype from T_BC_DailyLoanBill where fid=? "); else if((new EvectionReqBillInfo()).getBOSType().equals(type)) sql = sql.append("select famountcontroltype from T_BC_EvectionReqBill where fid=? "); else if((new EvectionLoanBillInfo()).getBOSType().equals(type)) sql = sql.append("select famountcontroltype from T_BC_EvectionLoanBill where fid=? "); Object params[] = { sourceBillId }; IRowSet rowSet = DbUtil.executeQuery(ctx, sql.toString(), params); try { if(rowSet.next()) controltype = rowSet.getInt("famountcontroltype"); } catch(SQLException e) { e.printStackTrace(); } return controltype == 20 || (new EvectionReqBillInfo()).getBOSType().equals(type); }
标签:rowSet,String,sql,表名,bosType,new,EAS,where,getBOSType From: https://www.cnblogs.com/ketoli/p/17325831.html