InvoiceParentChildrenSqlDao.sql.stg

46 lines | 938 B Blame History Raw Download
import "org/killbill/billing/util/entity/dao/EntitySqlDao.sql.stg"

tableName() ::= "invoice_parent_children"

tableFields(prefix) ::= <<
  <prefix>parent_invoice_id
, <prefix>child_invoice_id
, <prefix>child_account_id
, <prefix>created_by
, <prefix>created_date
>>

allTableFields(prefix) ::= <<
  <prefix>record_id
, <tableFields(prefix)>
>>

tableValues() ::= <<
  :parentInvoiceId
, :childInvoiceId
, :childAccountId
, :createdBy
, :createdDate
>>

allTableValues() ::= <<
  :recordId
, <tableValues()>
>>

getChildInvoicesByParentInvoiceId() ::= <<
   SELECT <allTableFields("")>
   FROM <tableName()>
   WHERE parent_invoice_id = :parentInvoiceId
   <AND_CHECK_TENANT("")>
   <defaultOrderBy("")>
 >>

getParentChildMappingsByChildInvoiceIds(ids) ::= <<
   SELECT <allTableFields("")>
   FROM <tableName()>
   WHERE child_invoice_id in (<ids: {id | :id_<i0>}; separator="," >)
   <AND_CHECK_TENANT("")>
   <defaultOrderBy("")>
 >>