ast_car_license.lwm 5.14 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qm  
    $Date: 2014-4-21 上午9:52:31  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model 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_LICENSE">
    <bm:fields>
        <bm:field name="ast_car_license_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="AST_CAR_LICENSE_ID" prompt="AST_CAR_LICENSE.AST_CAR_LICENSE_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_LICENSE.ITEM_DETAIL_ID"/>
        <bm:field name="license_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LICENSE_NUMBER" prompt="AST_CAR_LICENSE.LICENSE_NUMBER" required="true"/>
        <bm:field name="on_car_date" databaseType="DATE" datatype="java.util.Date" physicalName="ON_CAR_DATE" prompt="AST_CAR_LICENSE.ON_CAR_DATE" required="true"/>
        <bm:field name="license_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LICENSE_FEE" prompt="AST_CAR_LICENSE.LICENSE_FEE"/>
        <bm:field name="license_attach_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LICENSE_ATTACH_FEE" prompt="AST_CAR_LICENSE.LICENSE_ATTACH_FEE"/>
        <bm:field name="shh_license_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SHH_LICENSE_FLAG" prompt="AST_CAR_LICENSE.SHH_LICENSE_FLAG"/>
        <bm:field name="purchase_date" databaseType="DATE" datatype="java.util.Date" physicalName="PURCHASE_DATE"/>
        <bm:field name="purchase_price" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PURCHASE_PRICE"/>
        <bm:field name="license_end_date" databaseType="DATE" datatype="java.util.Date" physicalName="LICENSE_END_DATE"/>
        <bm:field name="mortgage_date" databaseType="DATE" datatype="java.util.Date" physicalName="MORTGAGE_DATE"/>
        <bm:field name="enabled_flag"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
    			begin
                    insert into ast_car_license(
	                    ast_car_license_id,
	                    item_detail_id,
	                    license_number,
	                    on_car_date,
	                    license_fee,
	                    license_attach_fee,
	                    shh_license_flag,
	                    enabled_flag,
	                    purchase_date,
	                    purchase_price,
	                    license_end_date,
	                    mortgage_date,
	                    created_by,creation_date,last_update_date,last_updated_by
                    )values(
                    	ast_car_license_s.nextval,
	                    ${/parameter/@item_detail_id},
	                    ${@license_number},
	                    to_date(${@on_car_date},'yyyy-mm-dd'),
	                    ${@license_fee},
	                    ${@license_attach_fee},
	                    ${@shh_license_flag},
	                    ${@enabled_flag},
	                    to_date(${@purchase_date},'yyyy-mm-dd'),
	                    ${@purchase_price},
	                    to_date(${@license_end_date},'yyyy-mm-dd'),
	                    to_date(${@mortgage_date},'yyyy-mm-dd'),
	                    ${/session/@user_id},sysdate,sysdate,${/session/@user_id}
                    );
                    ast_car_pkg.check_license_enable(p_item_detail_id => ${/parameter/@item_detail_id},
                                   p_user_id => ${/session/@user_id});
    			end;
    		]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
          begin
				UPDATE AST_CAR_LICENSE t1
				   SET t1.ITEM_DETAIL_ID     = ${@item_detail_id},
				       t1.LICENSE_NUMBER     = ${@license_number},
				       t1.ON_CAR_DATE        = to_date(${@on_car_date},'yyyy-mm-dd'),
				       t1.LICENSE_FEE        = ${@license_fee},
				       t1.LICENSE_ATTACH_FEE = ${@license_attach_fee},
				       t1.enabled_flag       = ${@enabled_flag},
				       t1.SHH_LICENSE_FLAG   = ${@shh_license_flag},
				       t1.PURCHASE_DATE      = to_date(${@purchase_date},'yyyy-mm-dd'),
				       t1.PURCHASE_PRICE     = ${@purchase_price},
				       t1.LICENSE_END_DATE   = to_date(${@license_end_date},'yyyy-mm-dd'),
				       t1.mortgage_date   = to_date(${@mortgage_date},'yyyy-mm-dd'),
				       t1.LAST_UPDATED_BY    = ${/session/@user_id},
				       t1.LAST_UPDATE_DATE   = sysdate
				 WHERE t1.AST_CAR_LICENSE_ID = ${@ast_car_license_id};
				 ast_car_pkg.check_license_enable(p_item_detail_id => ${@item_detail_id},
                                   p_user_id => ${/session/@user_id});
          end;
        ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk sequenceName="ast_car_license_s"/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="ast_car_license_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="item_detail_id" queryOperator="="/>
    </bm:query-fields>
</bm:model>