|
楼主 |
发表于 2014-5-14 10:07:53
|
显示全部楼层
没有JS,直接执行数据库
Table table =KSQL.select("select gl_balance.* from gl_balance gl_balance where gl_balance.facc_name='GL三店及公司支出' order by gl_balance.famount_date ,gl_balance.fopreattime ", null, "/graylaus/gl/data", null);
BigDecimal balance=new BigDecimal(559227.02);
if (table.size() > 0) {
Iterator<Row> rows = table.iterator();
while (rows.hasNext()) {
Row row = rows.next();
String fid=row.getString("gl_balance");
BigDecimal money=row.getDecimal("finmoney");
balance=balance.add(money);
String sql="update gl_balance gl_balance set gl_balance.fbalance_money="+balance+" where gl_balance='"+ fid +"' ";
System.out.println(sql);
KSQL.executeUpdate(sql, null, "/graylaus/gl/data", null);
/*Connection conn = ModelUtils.getConnectionInTransaction("/graylaus/gl/data");
PreparedStatement pstmt = conn.prepareStatement("update gl_balance set fbalance_money=? where fid=? ");
pstmt.setDouble(1, balance.doubleValue());
pstmt.setString(2, fid);
pstmt.executeUpdate();*/
}
} |
|