<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Icon  
    $Date: 2014-11-5 下午2:46:13  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:fields>
        <bm:field name="special_retail_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SPECIAL_RETAIL_ID" prompt="PRJ_SPECIAL_RETAIL.SPECIAL_RETAIL_ID"/>
        <bm:field name="special_retail_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SPECIAL_RETAIL_NUMBER" prompt="PRJ_SPECIAL_RETAIL.SPECIAL_RETAIL_NUMBER"/>
        <bm:field name="user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="USER_ID" prompt="PRJ_SPECIAL_RETAIL.USER_ID"/>
        <bm:field name="customer_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CUSTOMER_NAME" prompt="PRJ_SPECIAL_RETAIL.CUSTOMER_NAME"/>
        <bm:field name="years_of_application" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="YEARS_OF_APPLICATION" prompt="PRJ_SPECIAL_RETAIL.YEARS_OF_APPLICATION"/>
        <bm:field name="product_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRODUCT_NAME" prompt="PRJ_SPECIAL_RETAIL.PRODUCT_NAME"/>
        <bm:field name="brand_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BRAND_ID" prompt="PRJ_SPECIAL_RETAIL.BRAND_ID"/>
        <bm:field name="series_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SERIES_ID" prompt="PRJ_SPECIAL_RETAIL.SERIES_ID"/>
        <bm:field name="model_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MODEL_ID" prompt="PRJ_SPECIAL_RETAIL.MODEL_ID"/>
        <bm:field name="risk_open" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RISK_OPEN" prompt="PRJ_SPECIAL_RETAIL.RISK_OPEN"/>
        <bm:field name="special_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SPECIAL_CATEGORY" prompt="PRJ_SPECIAL_RETAIL.SPECIAL_CATEGORY"/>
        <bm:field name="status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS" prompt="PRJ_SPECIAL_RETAIL.STATUS"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="PRJ_SPECIAL_RETAIL.DESCRIPTION"/>
        <bm:field name="special_content" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SPECIAL_CONTENT" prompt="PRJ_SPECIAL_RETAIL.SPECIAL_CONTENT"/>
        <bm:field name="apply_reason" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="APPLY_REASON" prompt="PRJ_SPECIAL_RETAIL.APPLY_REASON"/>
        <bm:field name="user_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="USER_NAME"/>
        <bm:field name="status_des" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS_DES"/>
        <bm:field name="special_category_des" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SPECIAL_CATEGORY_DES"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select * from (
                SELECT
                    psr.*,
                    (SELECT su.description user_name FROM sys_user su WHERE su.user_id = psr.user_id
                    ) user_name,
                    (SELECT
                        v.code_value_name
                    FROM
                        sys_code_values_v v
                    WHERE
                        v.code       = 'PRJ801_SPECIAL_RETAIL_STATUS' AND
                        v.code_value = psr.status
                    ) status_des,
                    (SELECT
                        v.code_value_name
                    FROM
                        sys_code_values_v v
                    WHERE
                        v.code       = 'PRJ801_SPECIAL_RETAIL_CATEGORY' AND
                        v.code_value = psr.special_category
                    ) special_category_des
                FROM
                    PRJ_SPECIAL_RETAIL psr) t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field field="special_retail_number" queryOperator="like"/>
        <bm:query-field field="user_name" queryOperator="like"/>
        <bm:query-field field="customer_name" queryOperator="like"/>
        <bm:query-field field="special_category" queryOperator="="/>
        <bm:query-field field="status" queryOperator="="/>
    </bm:query-fields>
</bm:model>
