org.killbill.billing.payment.dao.PaymentSqlDao.sql.stg Maven / Gradle / Ivy
group PaymentSqlDao: EntitySqlDao;
tableName() ::= "payments"
historyTableName() ::= "payment_history"
extraTableFieldsWithComma(prefix) ::= <<
, record_id as payment_number
>>
defaultOrderBy(prefix) ::= <<
order by created_date ASC, ASC
>>
tableFields(prefix) ::= <<
account_id
, payment_method_id
, external_key
, state_name
, last_success_state_name
, created_by
, created_date
, updated_by
, updated_date
>>
tableValues() ::= <<
:accountId
, :paymentMethodId
, :externalKey
, :stateName
, :lastSuccessStateName
, :createdBy
, :createdDate
, :updatedBy
, :updatedDate
>>
updatePaymentForNewTransaction() ::= <<
update
set updated_by = :updatedBy
, updated_date = :createdDate
where id = :id
;
>>
updatePaymentStateName() ::= <<
update
set state_name = :stateName
, updated_by = :updatedBy
, updated_date = :createdDate
where id = :id
;
>>
updateLastSuccessPaymentStateName() ::= <<
update
set state_name = :stateName
, last_success_state_name = :lastSuccessStateName
, updated_by = :updatedBy
, updated_date = :createdDate
where id = :id
;
>>
getPaymentByExternalKey() ::= <<
select
from
where external_key = :externalKey
;
>>
searchQuery(prefix) ::= <<
= :searchKey
or account_id = :searchKey
or payment_method_id = :searchKey
or external_key like :likeSearchKey
or state_name like :likeSearchKey
>>
getByPluginName() ::= <<
select
from t
join payment_methods pm on pm.id = t.payment_method_id
where pm.plugin_name = :pluginName
order by t.record_id asc
limit :offset, :rowCount
;
>>
getCountByPluginName() ::= <<
select
count(1) as count
from t
join payment_methods pm on pm.id = t.payment_method_id
where pm.plugin_name = :pluginName
;
>>
getPaymentsByStates(states) ::= <<
select
from t
where
created_date >= :createdAfterDate
and created_date \<= :createdBeforeDate
and state_name in (}; separator="," >)
limit :limit
;
>>