AccountEmailSqlDao.sql.stg

50 lines | 838 B Blame History Raw Download
group account_emails: EntitySqlDao;


tableFields(prefix) ::= <<
  account_id
, email
, created_by
, created_date
, updated_by
, updated_date
>>


tableValues() ::= <<
  :accountId
, :email
, :createdBy
, :createdDate
, :updatedBy
, :updatedDate
 >>

historyTableName() ::= "account_email_history"

getEmailByAccountId() ::= <<
select
<allTableFields()>
from <tableName()>
where account_id = :accountId
<AND_CHECK_TENANT()>
;
>>

updateFromTransaction() ::= <<
    UPDATE account_emails
    SET email = :email, updated_by = :userName, updated_date = :updatedDate
    WHERE id = :id <AND_CHECK_TENANT()>;
>>

deleteFromTransaction() ::= <<
    DELETE FROM account_emails
    WHERE id = :id <AND_CHECK_TENANT()>;
>>


getByAccountId() ::= <<
    SELECT <fields()> FROM account_emails WHERE account_id = :accountId <AND_CHECK_TENANT()>;
>>