<?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
                    *
                FROM
                    (SELECT
                        cc.project_id,
                        cc.project_number,
                        cc.project_name,
                        cc.bp_id_tenant,
                        (SELECT hbm.bp_name FROM hls_bp_master hbm WHERE hbm.bp_id = cc.bp_id_tenant
                        ) bp_id_tenant_n,
                        cc.hn_industry_classification,
                        cc.hn_industry_classification_n,
                        cc.employee_id,
                        cc.employee_id_n,
                        TO_CHAR(cc.inception_of_lease,'YYYY-MM-DD') inception_of_lease,
                        hd.hd_detail,
                        hd.record_type,
                        (SELECT
                            v.code_value_name
                        FROM
                            sys_code_values_v v
                        WHERE
                            v.code       = 'PAYMENT_CON_HD_TYPE' AND
                            v.code_value = hd.record_type
                        ) record_type_n,
                        hd.note,
                        hd.description,
                        hd.hd_id
                    FROM
                        prj_project_lv cc,
                        hn_con_payment_con_hd hd
                    WHERE
                        cc.project_id = hd.project_id AND
                        hd.data_class = 'NORMAL'
                    ) t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <!--     <bm:fields>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" required="true"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER" required="true"/>
        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NAME"/>
        <bm:field name="bp_id_tenant" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_TENANT" required="true"/>
        <bm:field name="bp_id_tenant_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_ID_TENANT_N"/>
        <bm:field name="hn_industry_classification" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="HN_INDUSTRY_CLASSIFICATION"/>
        <bm:field name="hn_industry_classification_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="HN_INDUSTRY_CLASSIFICATION_N"/>
        <bm:field name="employee_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EMPLOYEE_ID"/>
        <bm:field name="employee_id_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EMPLOYEE_ID_N"/>
        <bm:field name="inception_of_lease" databaseType="DATE" datatype="java.util.Date" physicalName="INCEPTION_OF_LEASE"/>
    </bm:fields> -->
</bm:model>
