TenantKVSqlDao.sql.stg

49 lines | 810 B Blame History Raw Download
group TenantKVSqlDao: EntitySqlDao;

tableName() ::= "tenant_kvs"

andCheckSoftDeletionWithComma(prefix) ::= "and <prefix>is_active"

tableFields(prefix) ::= <<
  <prefix>tenant_key
, <prefix>tenant_value
, <prefix>is_active
, <prefix>created_date
, <prefix>created_by
, <prefix>updated_date
, <prefix>updated_by
>>

tableValues() ::= <<
  :tenantKey
, :tenantValue
, :isActive
, :createdDate
, :createdBy
, :updatedDate
, :updatedBy
>>

accountRecordIdFieldWithComma(prefix) ::= ""

accountRecordIdValueWithComma() ::= ""


getTenantValueForKey() ::= <<
select
  <allTableFields("t.")>
from <tableName()> t
where t.tenant_key = :tenantKey
and  t.is_active
<AND_CHECK_TENANT("t.")>
;
>>

markTenantKeyAsDeleted() ::= <<
update <tableName()> t
set t.is_active = 0
where t.id = :id
<AND_CHECK_TENANT("t.")>
;
>>