zj_wfl_45days.lwm 2.34 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wuyulun  
    $Date: 2015-7-15 下午4:05:25  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" rootpath="zj_wfl_45days">
    <bm:fields>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="bp_id_tenant_n" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="last_date" databaseType="DATE" datatype="java.util.Date"/>
        <bm:field name="days" databaseType="NUMBER" datatype="java.lang.Long"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    *
                FROM
                    (SELECT
                        *
                    FROM
                        (SELECT
                            b.contract_id ,
                            b.contract_number ,
                            b.bp_id_tenant ,
                            b.bp_id_tenant_n ,
                            MAX(a.due_date) last_date ,
                            MAX(a.due_date)-TRUNC(sysdate) days
                        FROM
                            con_contract_cashflow a,
                            con_contract_lv b
                        WHERE
                            a.contract_id     =b.contract_id AND
                            b.data_class      = 'NORMAL' AND
                            a.cf_type         =1 AND
                            b.contract_status = 'INCEPT'
                        GROUP BY
                            b.contract_id,
                            b.contract_number,
                            b.bp_id_tenant,
                            b.bp_id_tenant_n
                        )
                    WHERE
                        days <= 15
                    ) t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:primary-key>
        <bm:pk-field name="contract_id"/>
    </bm:primary-key>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="exists (select 1 from sys_user_role_groups a where a.user_id=${/session/@user_id} and role_id in (160,1))"/>
    </bm:data-filters>
</bm:model>