CustomFieldSqlDao.sql.stg

55 lines | 883 B Blame History Raw Download
group CustomFieldSqlDao: EntitySqlDao;

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

tableName() ::= "custom_fields"

tableFields(prefix) ::= <<
  <prefix>object_id
, <prefix>object_type
, <prefix>is_active
, <prefix>field_name
, <prefix>field_value
, <prefix>created_by
, <prefix>created_date
, <prefix>updated_by
, <prefix>updated_date
>>

tableValues() ::= <<
  :objectId
, :objectType
, :isActive
, :fieldName
, :fieldValue
, :createdBy
, :createdDate
, :updatedBy
, :updatedDate
>>

historyTableName() ::= "custom_field_history"

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


getCustomFieldsForObject() ::= <<
select
<allTableFields()>
from <tableName()>
where
object_id = :objectId
and object_type = :objectType
and is_active
<AND_CHECK_TENANT()>
<defaultOrderBy()>
;
>>