<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2016-1-18 上午10:14:04  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:e="leaf.service.exception" xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="SDIC_COMPANY_PERIOD_PROFITS">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
		            SELECT T.RECORD_ID,
		   			T.COMPNAY_ID,
		   			T.INTERNAL_PERIOD_NUM,
			       T.YEAR_PROFITS,
			       T.MONTH_PROFITS,
			       (SELECT TT.PERIOD_NAME
			  FROM GLD_PERIOD_STATUS_V TT
			 WHERE TT.INTERNAL_PERIOD_NUM = t.internal_period_num) period_name
			  FROM SDIC_COMPANY_PERIOD_PROFITS T
			  #WHERE_CLAUSE#
			  ORDER BY period_name DESC
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECORD_ID" prompt="SDIC_COMPANY_PERIOD_PROFITS.RECORD_ID"/>
        <bm:field name="compnay_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPNAY_ID" prompt="SDIC_COMPANY_PERIOD_PROFITS.COMPNAY_ID"/>
        <bm:field name="internal_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERNAL_PERIOD_NUM" prompt="SDIC_COMPANY_PERIOD_PROFITS.INTERNAL_PERIOD_NUM"/>
        <bm:field name="year_profits" databaseType="NUMBER" datatype="java.lang.Long" physicalName="YEAR_PROFITS" prompt="SDIC_COMPANY_PERIOD_PROFITS.YEAR_PROFITS"/>
        <bm:field name="month_profits" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MONTH_PROFITS" prompt="SDIC_COMPANY_PERIOD_PROFITS.MONTH_PROFITS"/>
        <bm:field name="period_name" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="record_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="internal_period_num" queryOperator="="/>
    </bm:query-fields>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="利润维护期间不能重复！"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
