import "org/killbill/billing/util/entity/dao/EntitySqlDao.sql.stg"
tableName() ::= "invoice_tracking_ids"
tableFields(prefix) ::= <<
<prefix>tracking_id
, <prefix>invoice_id
, <prefix>subscription_id
, <prefix>unit_type
, <prefix>record_date
, <prefix>is_active
, <prefix>created_by
, <prefix>created_date
, <prefix>updated_by
, <prefix>updated_date
>>
tableValues() ::= <<
:trackingId
, :invoiceId
, :subscriptionId
, :unitType
, :recordDate
, :isActive
, :createdBy
, :createdDate
, :updatedBy
, :updatedDate
>>
deactivateForInvoice() ::= <<
update <tableName()>
set
is_active = false
, updated_by = :createdBy
, updated_date = :updatedDate
where
invoice_id = :invoiceId
<AND_CHECK_TENANT("")>
;
>>
getTrackingsByDateRange() ::= <<
select
<allTableFields("")>
from <tableName()>
where
record_date >= :startDate
and record_date \< :endDate
and <accountRecordIdField("")> = :accountRecordId
and is_active = true
<AND_CHECK_TENANT("")>
<defaultOrderBy("")>
;
>>
getTrackingsForInvoice() ::= <<
select
<allTableFields("")>
from <tableName()>
where
invoice_id = :invoiceId
and <accountRecordIdField("")> = :accountRecordId
and is_active = true
<AND_CHECK_TENANT("")>
<defaultOrderBy("")>
;
>>