<?xml version="1.0" encoding="UTF-8"?>

<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="true">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select decode(t.division, 70, nvl(t.division_detail, '01'), '') division_detail
              from hls_bp_master_agent_division t
             where t.division = ${/parameter/@division}
               and t.bp_id = ${/parameter/@invoice_agent_id}
               and ${/parameter/@project_id} is null
            union
            select decode(t.division, 70, nvl(t.division_detail, '01'), '') division_detail
              from hls_bp_master_agent_division t, prj_project pp
             where t.division = pp.division
               and t.bp_id = pp.invoice_agent_id
               and pp.project_id = ${/parameter/@project_id}
               and ${/parameter/@project_id} is not null

                ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
