<?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:parameters>
                <bm:parameter name="abs_id" dataType="java.lang.Long" input="true" output="false"/>
            </bm:parameters>
            <bm:query-sql><![CDATA[
            select * from(
            select cc.contract_number,
			       cc.contract_name,
			       cc.contract_id,
			       cc.bp_id_tenant,
			       (SELECT hbm.bp_name
						          FROM hls_bp_master hbm
						         WHERE hbm.bp_id = cc.bp_id_tenant) lessee_name, --承租方
			       hn_abs_project_pkg.get_con_start_times(p_contract_id => cc.contract_id,
			                                              p_abs_id      => ${@abs_id}) start_times,--起始期数
			       hn_abs_project_pkg.get_con_end_times(p_contract_id => cc.contract_id,
			                                              p_abs_id      => ${@abs_id}) end_times--终止期数
			from con_contract cc 
			where cc.data_class = 'NORMAL'
				AND NVL(cc.hn_adjust_review_flag, 'N') = 'Y'
				) t1 #WHERE_CLAUSE#
				]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" forDisplay="true" forQuery="true" physicalName="CONTRACT_NUMBER" prompt="合同编号"/>
        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="500" forDisplay="true" forQuery="true" physicalName="CONTRACT_NAME" prompt="合同名称"/>
        <bm:field name="lessee_name"/>
        <bm:field name="start_times"/>
        <bm:field name="end_times"/>
        <bm:field name="contract_id"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="contract_number" queryOperator="like"/>
        <bm:query-field field="contract_name" queryOperator="like"/>
    </bm:query-fields>
</bm:model>
