版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hans201507/article/details/51073891
1.查询一列的和
detachedCriteria.setProjection(Projections.sum("payAmount"));
2.查询两列积的和
detachedCriteria.setProjection(Projections.sqlProjection("sum(amount*price) as result", new String[] { "result" }, new Type[] { new DoubleType() }));