<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
			select decode(v.con_num, 0, 'N', 'Y') statusFlag
    from (select (select count(1)
                    from con_contract t1
                   where t1.data_class in ('NORMAL', 'CHANGE_REQ')
                     and t1.ec_sign_type in ('INITIATE', 'SIGNING')
                     and t1.sign_type = 'ELE_SIGN'
                     and ((${@account_type} in ('LP', 'AG') and exists
                          (select 1
                              from con_contract_bp cb, hls_bp_master hb
                             where cb.bp_id = hb.bp_id
                               and cb.contract_id = t1.contract_id
                               and hb.social_code = ${@organization_id}) and
                          exists
                          (select 1
                              from con_contract_ele_signer cs
                             where cs.id_no = ${@id_no}
                               and cs.contract_id = t1.contract_id)))) con_num
            from dual) v

            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="statusFlag"/>
    </bm:fields>
</bm:model>
