一个SQL语句:
public static Query countShopRepairOrderServiceIncome(Session session, long shopId, long startTime, long endTime) {
return session.createSQLQuery(" select re.* from repair_order_service re where re.repair_order_id in ( " +
"select id from repair_order ro where ro.shop_id =:shopId and ro.status = 3 and ro.created >= :startTime and ro.created < :endTime ) ").addEntity(RepairOrderService.class)
.setLong("shopId", shopId)
.setLong("startTime", startTime)
.setLong("endTime", endTime);
}