标签:cti 方法 rom result ble criteria ram int create
这个东西,难度几乎没有,就是繁琐。
一条简单的select count(*) from table_name
都能有多种书写方式。
总是忘,这里记录下。
Criteria criteriaCount = getCriteria(); criteriaCount = criteriaCount.add(Restrictions.eq("dispatchTaskId", dispatchTaskId)); criteriaCount.setProjection(Projections.rowCount()); Integer totalCount = ((Long) criteriaCount.uniqueResult()).intValue();
SQLQuery queryCount = getSession().createSQLQuery("SELECT COUNT(*) FROM incidentInformation WHERE ii.incidentInformationId = :incidentInformationId AND dti.taskstate = :taskstate"); queryCount.setParameter("incidentInformationId", incidentInformationId); queryCount.setParameter("taskstate", ETaskStatus.STATUS_INIT.getStatusValue()); int count = ((BigDecimal) queryCount.uniqueResult()).intValue(); return count;
String countHql = "select count(*) from a where and a.approveResult = :approveResult and a.approverId = :approverId"; Query countQuery = getSession().createQuery(countHql); countQuery.setParameter("approverId", approverId); int count = ((Long) countQuery.uniqueResult()).intValue();
标签:cti 方法 rom result ble criteria ram int create
原文地址:https://www.cnblogs.com/grey-wolf/p/10209946.html