<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qm  
    $Date: 2014-4-21 上午10:00:36  
    $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="AST_CAR_INSURANCE">
    <bm:fields>
        <bm:field name="ast_car_insurance_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="AST_CAR_INSURANCE_ID" prompt="AST_CAR_INSURANCE.AST_CAR_INSURANCE_ID"/>
        <bm:field name="item_detail_id" databaseType="NUMBER" datatype="java.lang.Long" insertExpression="${/parameter/@item_detail_id}" physicalName="ITEM_DETAIL_ID" prompt="AST_CAR_INSURANCE.ITEM_DETAIL_ID"/>
        <bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID" prompt="AST_CAR_INSURANCE.BP_ID" required="true"/>
        <bm:field name="insurer_dis" expression="(select bp_name from hls_bp_master where bp_id = t1.bp_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="insurance_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INSURANCE_NUMBER" prompt="AST_CAR_INSURANCE.INSURANCE_NUMBER" required="true"/>
        <bm:field name="insurance_description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INSURANCE_DESCRIPTION" prompt="AST_CAR_INSURANCE.INSURANCE_DESCRIPTION"/>
        <bm:field name="insure_date" databaseType="DATE" datatype="java.util.Date" physicalName="INSURE_DATE" prompt="AST_CAR_INSURANCE.INSURE_DATE"/>
        <bm:field name="insurance_date_from" databaseType="DATE" datatype="java.util.Date" physicalName="INSURANCE_DATE_FROM" prompt="AST_CAR_INSURANCE.INSURANCE_DATE_FROM" required="true"/>
        <bm:field name="insurance_date_to" databaseType="DATE" datatype="java.util.Date" physicalName="INSURANCE_DATE_TO" prompt="AST_CAR_INSURANCE.INSURANCE_DATE_TO" required="true"/>
        <bm:field name="insurance_year" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INSURANCE_YEAR" prompt="AST_CAR_INSURANCE.INSURANCE_YEAR"/>
        <bm:field name="compulsory_insurance_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPULSORY_INSURANCE_AMOUNT" prompt="AST_CAR_INSURANCE.COMPULSORY_INSURANCE_AMOUNT" required="true"/>
        <bm:field name="commercial_insurance_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMMERCIAL_INSURANCE_AMOUNT" prompt="AST_CAR_INSURANCE.COMMERCIAL_INSURANCE_AMOUNT"/>
        <bm:field name="damage_insurance_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DAMAGE_INSURANCE_FLAG" prompt="AST_CAR_INSURANCE.DAMAGE_INSURANCE_FLAG"/>
        <bm:field name="third_party_insurance_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="THIRD_PARTY_INSURANCE_FLAG" prompt="AST_CAR_INSURANCE.THIRD_PARTY_INSURANCE_FLAG"/>
        <bm:field name="pilfer_insurance_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PILFER_INSURANCE_FLAG" prompt="AST_CAR_INSURANCE.PILFER_INSURANCE_FLAG"/>
        <bm:field name="basic_non_deductible_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BASIC_NON_DEDUCTIBLE_FLAG" prompt="AST_CAR_INSURANCE.BASIC_NON_DEDUCTIBLE_FLAG"/>
        <bm:field name="glass_insurance_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="GLASS_INSURANCE_FLAG" prompt="AST_CAR_INSURANCE.GLASS_INSURANCE_FLAG"/>
        <bm:field name="seat_insurance_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SEAT_INSURANCE_FLAG" prompt="AST_CAR_INSURANCE.SEAT_INSURANCE_FLAG"/>
        <bm:field name="combustion_insurance_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COMBUSTION_INSURANCE_FLAG" prompt="AST_CAR_INSURANCE.COMBUSTION_INSURANCE_FLAG"/>
        <bm:field name="add_non_deductible_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ADD_NON_DEDUCTIBLE_FLAG" prompt="AST_CAR_INSURANCE.ADD_NON_DEDUCTIBLE_FLAG"/>
        <bm:field name="compulsory_rebate_rate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPULSORY_REBATE_RATE"/>
        <bm:field name="combustion_rebate_rate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMBUSTION_REBATE_RATE"/>
        <bm:field name="compulsory_rebate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPULSORY_REBATE"/>
        <bm:field name="combustion_rebate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMBUSTION_REBATE"/>
        <bm:field name="insure_place" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INSURE_PLACE"/>
        <bm:field name="insure_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INSURE_NAME"/>
        <bm:field name="first_beneficiary" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIRST_BENEFICIARY"/>
        <bm:field name="insurance_party" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INSURANCE_PARTY"/>
        <!-- COMPULSORY_REBATE_RATE      NUMBER,
  COMBUSTION_REBATE_RATE      NUMBER,
  COMPULSORY_REBATE           NUMBER,
  COMBUSTION_REBATE           NUMBER,
  INSURE_PLACE                VARCHAR2(200),
  INSURE_NAME                 VARCHAR2(30),
  FIRST_BENEFICIARY           VARCHAR2(30),
  INSURANCE_PARTY             VARCHAR2(200) -->
    </bm: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:features>
        <f:standard-who/>
        <o:sequence-pk sequenceName="AST_CAR_INSURANCE_S"/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="ast_car_insurance_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="item_detail_id" queryOperator="="/>
    </bm:query-fields>
    <bm:operations>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
            begin
                delete from ast_car_insurance a
                where  
                   a.ast_car_insurance_id =${@ast_car_insurance_id};
        		delete from
				    ast_car_insurance_records t
				where 
				    t.ast_car_insurance_id =${@ast_car_insurance_id};
				    end;
        	]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
