SubscriptionSqlDao.sql.stg

84 lines | 1.565 kB Blame History Raw Download
group SubscriptionSqlDao: EntitySqlDao;


tableFields(prefix) ::= <<
  <prefix>bundle_id
, <prefix>category
, <prefix>start_date
, <prefix>bundle_start_date
, <prefix>active_version
, <prefix>charged_through_date
, <prefix>paid_through_date
, <prefix>created_by
, <prefix>created_date
, <prefix>updated_by
, <prefix>updated_date
>>

tableValues() ::= <<
  :bundleId
, :category
, :startDate
, :bundleStartDate
, :activeVersion
, :chargedThroughDate
, :paidThroughDate
, :createdBy
, :createdDate
, :updatedBy
, :updatedDate
>>


getSubscriptionsFromBundleId() ::= <<
    select
      id
      , bundle_id
      , category
      , start_date
      , bundle_start_date
      , active_version
      , charged_through_date
      , paid_through_date
      , created_date
      , updated_date
    from subscriptions
    where bundle_id = :bundleId
    <AND_CHECK_TENANT()>
    ;
>>

updateChargedThroughDate() ::= <<
    update subscriptions
    set
      charged_through_date = :chargedThroughDate
      , updated_by = :userName
      , updated_date = :updatedDate
    where id = :id
    <AND_CHECK_TENANT()>
    ;
>>

updateActiveVersion() ::= <<
    update subscriptions
    set
      active_version = :activeVersion
      , updated_by = :userName
      , updated_date = :updatedDate
    where id = :id
    ;
>>

updateForRepair() ::= <<
    update subscriptions
    set
      active_version = :activeVersion
      , start_date = :startDate
      , bundle_start_date = :bundleStartDate
      , updated_by = :userName
      , updated_date = :updatedDate
    where id = :id
    <AND_CHECK_TENANT()>
    ;
>>