<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: 王建文  
    $Date: 2017-3-6 下午7:49:17  
    $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
                        A.*,
                        ROWNUM RN
                    FROM
                        (SELECT
                            t.project_id,
                            t.project_number,
                            t.project_name,
                            t.project_status,
                            t.bp_class,
                            t.bp_class_n,
                            t.business_type,
                            t.business_type_n,
                            t.division,
                            t.division_n,
                            t.car_type,
                            t.car_type_n,
                            t.finance_amount,
                            t.bp_name,
                            t.invoice_agent_id,
                            t.invoice_agent_id_n,
                            t.cdd_list_id,
                            TO_CHAR(t.create_date,'yyyy-mm-dd') create_date
                        FROM
                            prj_project_lv t #WHERE_CLAUSE#
                        ORDER BY
                            t.project_id DESC
                        ) A
                    WHERE
                        ROWNUM <= NVL(${@pagesize},10) * NVL(${@offsize},1)
                    )
                WHERE
                    RN >= 1 + ((NVL(${@offsize},1)-1) * NVL(${@pagesize},10))
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID"/>
        <bm:field name="project_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NAME"/>
        <bm:field name="project_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_STATUS"/>
        <bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE"/>
        <bm:field name="business_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE_N"/>
        <bm:field name="bp_class" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS"/>
        <bm:field name="bp_class_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS_N"/>
        <bm:field name="division" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DIVISION"/>
        <bm:field name="division_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DIVISION_N"/>
        <bm:field name="car_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CAR_TYPE"/>
        <bm:field name="car_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CAR_TYPE_N"/>
        <bm:field name="finance_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FINANCE_AMOUNT"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME"/>
        <bm:field name="invoice_agent_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INVOICE_AGENT_ID"/>
        <bm:field name="invoice_agent_id_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_AGENT_ID_N"/>
        <bm:field name="cdd_list_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CDD_LIST_ID"/>
        <bm:field name="create_date" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CREATE_DATE"/>
        <bm:field name="project_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NUMBER"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="searchInput" queryExpression="(t.bp_name like &apos;%&apos;||${@searchInput}||&apos;%&apos; or t.project_name like &apos;%&apos;||${@searchInput}||&apos;%&apos; or t.project_number like &apos;%&apos;||upper(${@searchInput})||&apos;%&apos; or t.project_status=${@searchInput} or t.invoice_agent_id_n like &apos;%&apos;||${@searchInput}||&apos;%&apos; or t.bp_class_n like &apos;%&apos;||${@searchInput}||&apos;%&apos; or t.business_type_n like &apos;%&apos;||${@searchInput}||&apos;%&apos; or t.division_n like &apos;%&apos;||${@searchInput}||&apos;%&apos; or t.car_type_n like &apos;%&apos;||${@searchInput}||&apos;%&apos;)"/>
        <bm:query-field name="business_type" queryExpression="t.business_type=${@business_type}"/>
        <bm:query-field name="division" queryExpression="t.division=${@division}"/>
        <bm:query-field name="create_date" queryExpression="(to_char(t.create_date,&apos;yyyy&apos;)=${@create_date} or to_char(t.create_date,&apos;yyyyq&apos;)=${@create_date} or to_char(t.create_date,&apos;yyyy-mm&apos;)=${@create_date})"/>
    </bm:query-fields>
</bm:model>
