<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hand
    $Date: 2017-9-29 下午2:26:55
    $Revision: 1.0
    $Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            SELECT * FROM(
select  c.contract_id,
        c.contract_number,
       c.contract_name
        from con_contract c
        where c.data_class = 'NORMAL'
          )t1
          #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="contract_id" forDisplay="false" forQuery="false" prompt="ID"/>
        <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" forDisplay="false" forQuery="false" physicalName="contract_name" prompt="合同名称"/>
    </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:data-filters>
        <bm:data-filter expression="( exists (select 1 from aut_trx_user_authorize a1,aut_owner_user_authorize a2 where a1.trx_category = &apos;CONTRACT&apos; and a1.trx_id = t1.contract_id  and trunc(sysdate) between a1.start_date and nvl(a1.end_date,trunc(sysdate)) and a1.user_id = a2.owner_user_id and a1.trx_category = a2.trx_category  and a2.authorized_user_id = ${/session/@user_id} and trunc(sysdate) between a2.start_date and nvl(a2.end_date,trunc(sysdate))))"/>
    </bm:data-filters>
</bm:model>
