<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2014-1-26 下午5:43:53  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="GJ_EXPRESS">
    <bm:fields>
        <bm:field name="express_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EXPRESS_ID" prompt="GJ_EXPRESS.EXPRESS_ID"/>
        <bm:field name="from_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FROM_NAME" prompt="GJ_EXPRESS.FROM_NAME"/>
        <bm:field name="from_departure" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FROM_DEPARTURE" prompt="GJ_EXPRESS.FROM_DEPARTURE"/>
        <bm:field name="from_company" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FROM_COMPANY" prompt="GJ_EXPRESS.FROM_COMPANY"/>
        <bm:field name="from_address_province" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FROM_ADDRESS_PROVINCE" prompt="GJ_EXPRESS.FROM_ADDRESS_PROVINCE"/>
        <bm:field name="from_address_city" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FROM_ADDRESS_CITY" prompt="GJ_EXPRESS.FROM_ADDRESS_CITY"/>
        <bm:field name="from_address_district" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FROM_ADDRESS_DISTRICT" prompt="GJ_EXPRESS.FROM_ADDRESS_DISTRICT"/>
        <bm:field name="from_address_detail" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FROM_ADDRESS_DETAIL" prompt="GJ_EXPRESS.FROM_ADDRESS_DETAIL"/>
        <bm:field name="from_mobile" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FROM_MOBILE" prompt="GJ_EXPRESS.FROM_MOBILE"/>
        <bm:field name="from_signature" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FROM_SIGNATURE" prompt="GJ_EXPRESS.FROM_SIGNATURE"/>
        <bm:field name="to_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TO_NAME" prompt="GJ_EXPRESS.TO_NAME"/>
        <bm:field name="to_destination" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TO_DESTINATION" prompt="GJ_EXPRESS.TO_DESTINATION"/>
        <bm:field name="to_company" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TO_COMPANY" prompt="GJ_EXPRESS.TO_COMPANY"/>
        <bm:field name="to_address_province" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TO_ADDRESS_PROVINCE" prompt="GJ_EXPRESS.TO_ADDRESS_PROVINCE"/>
        <bm:field name="to_address_city" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TO_ADDRESS_CITY" prompt="GJ_EXPRESS.TO_ADDRESS_CITY"/>
        <bm:field name="to_address_district" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TO_ADDRESS_DISTRICT" prompt="GJ_EXPRESS.TO_ADDRESS_DISTRICT"/>
        <bm:field name="to_address_detail" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TO_ADDRESS_DETAIL" prompt="GJ_EXPRESS.TO_ADDRESS_DETAIL"/>
        <bm:field name="to_mobile" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TO_MOBILE" prompt="GJ_EXPRESS.TO_MOBILE"/>
        <bm:field name="print_year" databaseType="VARCHAR2" datatype="java.lang.String" prompt="GJ_EXPRESS.PRINT_YEAR"/>
        <bm:field name="print_month" databaseType="VARCHAR2" datatype="java.lang.String" prompt="GJ_EXPRESS.PRINT_MONTH"/>
        <bm:field name="print_day" databaseType="VARCHAR2" datatype="java.lang.String" prompt="GJ_EXPRESS.PRINT_DAY"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.express_id,
				       t1.from_name,
				       t1.from_departure,
				       t1.from_company,
				       t1.from_address_province,
				       t1.from_address_city,
				       t1.from_address_district,
				       t1.from_address_detail,
				       t1.from_mobile,
				       t1.from_signature,
				       t1.to_name,
				       t1.to_destination,
				       t1.to_company,
				       t1.to_address_province,
				       t1.to_address_city,
				       t1.to_address_district,
				       t1.to_address_detail,
				       t1.to_mobile,
				       to_char(t1.print_date, 'YYYY') as print_year,
				       to_char(t1.print_date, 'MM') as print_month,
				       to_char(t1.print_date, 'DD') as print_day
				  from gj_express t1
				 #WHERE_CLAUSE#
    		]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:parameters>
                <bm:parameter name="express_id" input="false" output="true" outputPath="@express_id"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
        		begin
				   ${@express_id} := gj_express_pkg.submit_print(p_source_type 	=> ${@source_type},
						                                         p_pk_id 		=> ${@pk_id},
						                                         p_user_id 		=> ${/session/@user_id});
				end;
        	]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.created_by = ${/session/@user_id}"/>
    </bm:data-filters>
    <bm:features>
        <f:standard-who/>
    </bm:features>
</bm:model>