<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
        	UPDATE
        	    hn_payment_cond_change_req t1
        	SET
        	    t1.description = ${@description}
        	WHERE
        	    t1.change_req_id = ${@change_req_id}
    	]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    *
                FROM
                    (SELECT
                    	hpccr.change_req_id,
                        hpccr.change_req_number, --变更编号
                        hpccr.req_date,          --变更日期
                        cc.bp_id_tenant,
                        (SELECT hbm.bp_name FROM hls_bp_master hbm WHERE hbm.bp_id=cc.bp_id_tenant
                        ) bp_name, --承租人名称
                        cc.employee_id,
                        (SELECT ee.name FROM exp_employees ee WHERE ee.employee_id = cc.employee_id
                        ) manager,          --项目经理
                        cc.contract_number, --支付编号
                        cc.contract_name,   --支付表名称
                        hpccr.description   --备注
                    FROM
                        hn_payment_cond_change_req hpccr,
                        hn_con_payment_con_hd hcpch,
                        con_contract cc
                    WHERE
                        hpccr.hd_id       = hcpch.hd_id AND
                        hcpch.contract_id = cc.contract_id AND
                        hpccr.change_req_id = ${@change_req_id}
                    ) t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
	 <bm:fields>
        <bm:field name="change_req_id"/>
        <bm:field name="change_req_number"/>
        <bm:field name="req_date"/>
        <bm:field name="bp_id_tenant"/>
        <bm:field name="bp_name"/>
        <bm:field name="employee_id"/>
        <bm:field name="manager"/>
        <bm:field name="contract_number"/>
        <bm:field name="contract_name"/>
        <bm:field name="description"/>
    </bm:fields>
    <!-- <bm:query-fields>
        <bm:query-field name="change_req_id" queryExpression="t1.change_req_id=${@change_req_id}"/>
    </bm:query-fields> -->
</bm:model>
