<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng  
    $Date: 2017-11-7 上午9:38:53  
    $Revision: 1.0  
    $Purpose: 付款先决条件变更头表
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="HN_PAYMENT_COND_CHANGE_HD">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
        SELECT
            *
        FROM
            (SELECT
                hd.header_id,
                hd.project_id,
                hd.change_req_number,
                hd.req_date,
                hd.wfl_instance_id,
                hd.req_status,
                hd.description,
                pp.project_number,
                pp.project_name,
                pp.bp_id_tenant,
                (SELECT hbm.bp_name FROM hls_bp_master hbm WHERE hbm.bp_id=pp.bp_id_tenant
                ) bp_name, --承租人名称
                pp.employee_id,
                (SELECT ee.name FROM exp_employees ee WHERE ee.employee_id = pp.employee_id
                ) manager --项目经理
            FROM
                hn_payment_cond_change_hd hd,
                prj_project pp
            WHERE
                hd.project_id  = pp.project_id 
                and hd.header_id = ${@header_id} 
            ) t1 
        ORDER BY
            t1.change_req_number
    ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
