All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.killbill.billing.entitlement.dao.BlockingStateSqlDao.sql.stg Maven / Gradle / Ivy

group BlockingStateSqlDao: EntitySqlDao;


tableName() ::= "blocking_states"

andCheckSoftDeletionWithComma(prefix) ::= "and is_active"

defaultOrderBy(prefix) ::= <<
order by effective_date ASC,  ASC
>>

tableFields(prefix) ::= <<
  blockable_id
, type
, state
, service
, block_change
, block_entitlement
, block_billing
, effective_date
, is_active
, created_by
, created_date
, updated_by
, updated_date
>>


tableValues() ::= <<
  :blockableId
, :type
, :state
, :service
, :blockChange
, :blockEntitlement
, :blockBilling
, :effectiveDate
, :isActive
, :createdBy
, :createdDate
, :updatedBy
, :updatedDate
>>


getBlockingStateForService() ::= <<
select

from

where blockable_id = :blockableId
and service = :service
and effective_date \<= :effectiveDate
and is_active

-- We want the current state, hence the order desc and limit 1
order by effective_date desc, record_id desc
limit 1
;
>>

getBlockingState() ::= <<
 select
 
 from
  t
 join (
   select max(record_id) record_id
         , service
         from blocking_states
         where blockable_id = :blockableId
         and effective_date \<= :effectiveDate
         and is_active
         
         group by service
 ) tmp
 on t.record_id = tmp.record_id
 
  ;
 >>

getBlockingHistoryForService() ::= <<
select

from

where blockable_id = :blockableId
and service = :service
and is_active


;
>>

unactiveEvent() ::= <<
update

set is_active = false
where id = :id

;
>>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy