String sql = "select sum(t.psjg) as sumpsjg from Rs_Review t where t.draftid = ? ";
SQLQuery sqlQuery =getSession().createSQLQuery(sql);
sqlQuery.setParameter(0, draftid);//set变量
sqlQuery.addScalar("sumpsjg", StandardBasicTypes.INTEGER);
Integer sum = ((Integer) sqlQuery.uniqueResult()).intValue();
return sum;
SQLQuery sqlQuery =getSession().createSQLQuery(sql);
sqlQuery.setParameter(0, draftid);//set变量
sqlQuery.addScalar("sumpsjg", StandardBasicTypes.INTEGER);
Integer sum = ((Integer) sqlQuery.uniqueResult()).intValue();
return sum;