<?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
                    t.project_number,
                    t.contract_number,
                    t.bp_id_tenant_n,
                    t.contract_status_n,
                    t.contract_status,
                    t.creation_date,
                    t.contract_id
                FROM
                    con_contract_lv t #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="project_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NUMBER"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER"/>
        <bm:field name="bp_id_tenant_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_ID_TENANT_N"/>
        <bm:field name="contract_status_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_STATUS_N"/>
        <bm:field name="contract_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_STATUS" required="true"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" required="true"/>
        <bm:field name="creation_date" databaseType="DATE" datatype="java.util.Date" physicalName="CREATION_DATE"/>
    </bm:fields>
    <bm:data-filters>
        <bm:data-filter name="data_class" enforceOperations="query" expression="t.data_class=&apos;NORMAL&apos;"/>
        <bm:data-filter name="access_token" enforceOperations="query" expression="exists  (select 1 from con_contract_bp cb,cus_weixin_register cr where cb.contract_id = t.contract_id and cb.id_type = cr.id_type and cb.id_card_no = cr.id_card_no and cb.enabled_flag=&apos;Y&apos; and cr.access_token=${@access_token})"/>
    </bm:data-filters>
    <bm:query-fields>
        <bm:query-field field="project_number" matchany="true" queryOperator="like"/>
        <bm:query-field field="contract_number" matchany="true" queryOperator="like"/>
        <bm:query-field field="bp_id_tenant_n" matchany="true" queryOperator="like"/>
        <bm:query-field field="contract_status" queryOperator="="/>
        <bm:query-field field="creation_date" queryExpression="trunc(t.creation_date) = to_date(${@creation_date},&apos;yyyy-mm-dd&apos;)"/>
    </bm:query-fields>
</bm:model>
