org.killbill.billing.usage.dao.RolledUpUsageSqlDao.sql.stg Maven / Gradle / Ivy
The newest version!
import "org/killbill/billing/util/entity/dao/EntitySqlDao.sql.stg"
tableName() ::= "rolled_up_usage"
tableFields(prefix) ::= <<
subscription_id
, unit_type
, record_date
, amount
, tracking_id
, created_by
, created_date
>>
tableValues() ::= <<
:subscriptionId
, :unitType
, :recordDate
, :amount
, :trackingId
, :createdBy
, :createdDate
>>
recordsWithTrackingIdExist() ::= <<
select
1
from
where subscription_id = :subscriptionId
and tracking_id = :trackingId
limit 1
;
>>
getUsageForSubscription() ::= <<
select
from
where subscription_id = :subscriptionId
and record_date >= :startDate
and record_date \< :endDate
and unit_type = :unitType
;
>>
getAllUsageForSubscription() ::= <<
select
from
where subscription_id = :subscriptionId
and record_date >= :startDate
and record_date \< :endDate
;
>>
/** This is the only query used for invoicing, hence the <= :endDate (to handle usage data at the cancellation day) **/
getRawUsageForAccount() ::= <<
select
from
where account_record_id = :accountRecordId
and record_date >= :startDate
and record_date \<= :endDate
;
>>