CustomFieldSqlDao.sql.stg

67 lines | 1.476 kB Blame History Raw Download
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"

updateFromTransaction() ::= <<
    UPDATE custom_fields
    SET field_value = :fieldValue, updated_by = :userName, updated_date = :updatedDate
    WHERE object_id = :objectId AND object_type = :objectType AND field_name = :fieldName
    <AND_CHECK_TENANT()>
    ;
>>

deleteFromTransaction() ::= <<
    DELETE FROM custom_fields
    WHERE object_id = :objectId AND object_type = :objectType AND field_name = :fieldName
    <AND_CHECK_TENANT()>
    ;
>>

load() ::= <<
    SELECT id, object_id, object_type, field_name, field_value, created_by, created_date, updated_by, updated_date
    FROM custom_fields
    WHERE object_id = :objectId AND object_type = :objectType
    <AND_CHECK_TENANT()>
    ;
>>

getRecordIds() ::= <<
    SELECT record_id, id
    FROM custom_fields
    WHERE object_id = :objectId AND object_type = :objectType
    <AND_CHECK_TENANT()>
    ;
>>

getHistoryRecordIds() ::= <<
    SELECT history_record_id, record_id
    FROM custom_field_history
    WHERE history_record_id > :maxHistoryRecordId
    <AND_CHECK_TENANT()>
    ;
>>