本文共 315 字,大约阅读时间需要 1 分钟。
1.查询一列的和
detachedCriteria.setProjection(Projections.sum("payAmount"));
2.查询两列积的和
detachedCriteria.setProjection(Projections.sqlProjection("sum(amount*price) as result", new String[] { "result" }, new Type[] { new DoubleType() }));