EAS BOS sql 查询

在EditUI中查询

private BigDecimal getBatchIncomeBillAmount(String projectId, String createTime, String type) throws BOSException, SQLException {
		StringBuilder sqlAimCostResoure = new StringBuilder();
		sqlAimCostResoure.append("select sum(b.famount) amount from T_EC_BatchIncomeBill a")
			.append(" left join T_EC_BatchIncomeEntry b on a.fid = b.fparentid ")
			.append("where a.fprojectid = '"+projectId+"' and a.fbillsate = '03' and fAuditDate = '"+createTime+"'")
			.append(" and CFRECEIVABLESTYPE = '"+type+"'");
		
		ISQLExecutor executor = SQLExecutorFactory.getRemoteInstance(sqlAimCostResoure.toString());
		IRowSet irRowSet = executor.executeSQL(); 
		if (irRowSet.size() > 0) {
			while(irRowSet.next()) {
				BigDecimal amount = irRowSet.getBigDecimal("amount");
				return amount != null ? amount : BigDecimal.ZERO;
			}
		}
		return BigDecimal.ZERO;
	}

在ControllerBean中查询

public BigDecimal getAimHunmanTotalAmount(Context ctx,String projectId) throws BOSException, SQLException{
		StringBuilder sqlAimCostResoure = new StringBuilder();
		
		sqlAimCostResoure.append("select sum(acr.famount) amount from T_EC_AimCostResource acr left join T_EC_AimCostBill acb ")
			.append("on acb.fid = acr.fbillId left join T_EC_CostAccount ca on ca.fid = acr.fcostAccountid ")
			.append("where acb.fprojectID = ? and acb.fbillSate = '03' and ca.fnumber = '01.01' and acb.fisvalid = 1 ");
		IRowSet irRowSet = DbUtil.executeQuery(ctx, sqlAimCostResoure.toString(), new Object[]{projectId});
		if(irRowSet.size() > 0){
			while(irRowSet.next()){
				return irRowSet.getBigDecimal("amount");
			}
		}
		return BigDecimal.ZERO;
	}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值