<?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
                    v.UNIT_ID,
                    v.UNIT_CODE,
                    decode(v.unit_code,'40','业务部',v.DESCRIPTION) unit_name
                FROM
                    exp_org_unit_vl v
                WHERE
                    v.UNIT_CODE IN ('30', '40', '50') AND
                    NOT EXISTS
                    (SELECT 1 FROM hn_wfl_unit_assigned hw WHERE hw.instance_id = ${@instance_id}
                    )
            ]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="instance_id"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="unit_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="UNIT_ID"/>
        <bm:field name="unit_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="UNIT_CODE"/>
        <bm:field name="unit_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="UNIT_NAME"/>
    </bm:fields>
</bm:model>
