<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hand  
    $Date: 2016-5-2 上午11:46:02  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="CON_CONTRACT_LOCATION">
    <bm:fields>
        <bm:field name="location_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LOCATION_ID" prompt="CON_CONTRACT_LOCATION.LOCATION_ID"/>
        <bm:field name="chest_number" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="80" forDisplay="true" forQuery="true" physicalName="CHEST_NUMBER" prompt="箱号"/>
        <bm:field name="years" databasetype="VARCHAR2" datatype="java.lang.String" displayWidth="80" forDisplay="true" forQuery="true" isprimarykey="true" physicalname="YEARS" prompt="年限"/>
        <bm:field name="doc_type_n" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="80" expression="(SELECT v.code_value_name AS value_name FROM sys_code_values_v v WHERE v.code   = &apos;DOC_TYPE&apos; AND v.code_value=t1.doc_type)" forDisplay="true" forInsert="false" forUpdate="false" physicalName="DOC_TYPE_N" prompt="文件类型"/>
        <bm:field name="docu_amount_n" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="80" expression="(select count(*)  from  con_contract_location_ln ccll where ccll.LOCATION_ID=t1.LOCATION_ID)" forDisplay="true" forInsert="false" forUpdate="false" prompt="已存文件数量"/>
        <bm:field name="storage" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STORAGE" prompt="仓库"/>
        <bm:field name="chest_floors" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CHEST_FLOORS" prompt="CON_CONTRACT_LOCATION.CHEST_FLOORS"/>
        <bm:field name="docu_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCU_NUMBER" prompt="CON_CONTRACT_LOCATION.DOCU_NUMBER"/>
        <bm:field name="docu_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DOCU_AMOUNT" prompt="CON_CONTRACT_LOCATION.DOCU_AMOUNT"/>
        <bm:field name="note" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NOTE" prompt="CON_CONTRACT_LOCATION.NOTE"/>
        <bm:field name="doc_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOC_TYPE" prompt="CON_CONTRACT_LOCATION.DOC_TYPE"/>
        <bm:field name="storage_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STORAGE_FLAG" prompt="CON_CONTRACT_LOCATION.STORAGE_FLAG"/>
        <bm:field name="created_person" expression="( select su.description value_name from sys_user su where su.user_id = t1.created_by)" forDisplay="true" forInsert="false" forUpdate="false" prompt="创建人"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="location_id"/>
    </bm:primary-key>
    <bm:data-filters>
        <bm:data-filter name="storage_flag" expression="t1.storage_flag=&apos;N&apos;"/>
    </bm:data-filters>
    <bm:query-fields>
        <bm:query-field name="doc_type" queryExpression="t1.doc_type=${/parameter/@doc_type}"/>
        <bm:query-field name="years" queryExpression="(t1.years=${@years} or t1.years=&apos;OTHER&apos;)"/>
    </bm:query-fields>
</bm:model>