group CustomFieldSqlDao: EntitySqlDao;
tableName() ::= "custom_fields"
tableFields(prefix) ::= <<
<prefix>object_id
, <prefix>object_type
, <prefix>field_name
, <prefix>field_value
, <prefix>created_by
, <prefix>created_date
, <prefix>updated_by
, <prefix>updated_date
>>
tableValues() ::= <<
:objectId
, :objectType
, :fieldName
, :fieldValue
, :createdBy
, :createdDate
, :updatedBy
, :updatedDate
>>
historyTableName() ::= "custom_field_history"
getCustomFieldsForObject() ::= <<
select
<allTableFields()>
from <tableName()>
where
object_id = :objectId
and object_type = :objectType
<AND_CHECK_TENANT()>
<defaultOrderBy()>
;
>>
searchCustomFields(searchKey, offset, rowCount) ::= <<
select SQL_CALC_FOUND_ROWS
<allTableFields("t.")>
from <tableName()> t
where 1 = 1
and (
<idField("t.")> = '<searchKey>'
or t.object_type like '%<searchKey>%'
or t.field_name like '%<searchKey>%'
or t.field_value like '%<searchKey>%'
)
<AND_CHECK_TENANT("t.")>
order by <recordIdField("t.")> ASC
limit :offset, :rowCount
;
>>