EAS_根据bosType或id获取表名,

复制代码
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);
    }
复制代码

 

posted @   凉了记忆  阅读(229)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具
点击右上角即可分享
微信分享提示