group NonEntitySqlDao;
getRecordIdFromObject(tableName) ::= <<
select
record_id
from <tableName>
where id = :id
;
>>
getIdFromObject(tableName) ::= <<
select
id
from <tableName>
where record_id = :recordId
;
>>
getAccountRecordIdFromAccountHistory() ::= <<
select
target_record_id
from account_history
where id = :id
;
>>
getAccountRecordIdFromAccount() ::= <<
select
record_id
from accounts
where id = :id
;
>>
getAccountRecordIdFromObjectOtherThanAccount(tableName) ::= <<
select
account_record_id
from <tableName>
where id = :id
;
>>
getTenantRecordIdFromTenant() ::= <<
select
record_id
from tenants
where id = :id
;
>>
getTenantRecordIdFromObjectOtherThanTenant(tableName) ::= <<
select
tenant_record_id
from <tableName>
where id = :id
;
>>
getLastHistoryRecordId(tableName) ::= <<
select
max(record_id)
from <tableName>
where target_record_id = :targetRecordId
;
>>
getHistoryTargetRecordId(tableName) ::= <<
select
target_record_id
from <tableName>
where record_id = :recordId
;
>>
getIdFromHistoryRecordId(tableName, historyTableName) ::= <<
select
t.id
from <tableName> t
join <historyTableName> ht on ht.target_record_id = t.record_id
where ht.record_id = :historyRecordId
limit 1
;
>>